public class Test { public static void main(String[] args) {
String str="kkakkkbkkc";
out(getCount(str,"kk")); }
public static void out(Object obj){
System.out.println(obj);
}
public static int getCount(String str,String key){
//int count=0;
str= "1"+str+"1";
out(str); }
String [] s=str.split(key);
int count=s.length-1;
return count;
}
} |