String max = "woaiheima,heimabutongyubaima,wulunheimahaishibaima,zhaodaogongzuojiushihaoma";
String min = "heima";
int index=0;
int count=0;
while((index = max.indexOf(min))!=-1){
count++;
max=max.substring(index+min.length());
}
System.out.println(count);
}} |
|