public class stringtest {
public static void main(String[] args){
String str = "nbaskjnabsdjnbaio";
int k = 0;
int a = 0;
while(a!=-1){
a = str.indexOf("nba",a);
if(a!=-1){
k++;
a+=3;
}
}
System.out.println(k);
}
}
public class stringtest {
public static void main(String[] args){
String str = "nbaskjnabsdjnbaio";
int k = 0;
int a = 0;
while(a!=-1){
a = str.indexOf("nba",a);
if(a!=-1){
k++;
a+=3;
}
}
System.out.println(k);
}
}
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M