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
VulpesPosted Jul 18, 2013, 3:32 PM
vasanth krishnaPosted Jul 19, 2013, 5:59 AM
Posted Jul 18, 2013, 4:31 PM
https://www.google.com/search?sitesearch=dotnetperls.com&q=IndexOf+