public class main {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String totalstr = new String("123sdasds123dsadas123sdfsdfsdf123rtgfg123");
String sub = new String("123");
int count = 0;
System.out.println( totalstr.indexOf("ysd"));
int i = 0;
while( !totalstr.isEmpty())
{
i = totalstr.indexOf(sub);
if(i == -1)
{
break;
}
i+=3;
count++;
totalstr = totalstr.substring(i);
}
System.out.println(count);
}
}