void main()
{
string name;
name = Console.ReadLine();
string s1 = Console.ReadLine();
Console.WriteLine(text1.cou(name,s1));
}
class text1
{
public static int cou(string name,string no)
{
int i = 0,c=0;
while((i=name.IndexOf(no,i))!=-1) // Explain this loop ,how it work
{
i = i + no.Length;
c++;
}
return c;
}
}
Loading

VulpesRank #55 · 29.2K reputationPosted Jul 18, 2013, 11:32 AM EDT
Posted Jul 18, 2013, 12:31 PM EDT
https://www.google.com/search?sitesearch=dotnetperls.com&q=IndexOf+
vasanth krishna41 reputationPosted Jul 19, 2013, 1:59 AM EDT