public class SB
{
public static void main(String[] args) {
String test="Hi I am here am am too good am very a m";
String find="am";
int i=0;
String a[]=test.split(" ");
for (int j = 0; j < a.length; j++) {
if(a[j].equals(find))
{
i++;
}
}
System.out.println(i);
}
}
No comments:
Post a Comment