using System; using System.Text; using System.Linq; using System.Collections.Generic; public class Program { public void Proc() { Reader.IsDebug = false; string text = Reader.ReadLine(); long ans = 0; int wordCount = int.Parse(Reader.ReadLine()); for(int i=0; i= 0 && curr <= endIdx) { int fnd = text.IndexOf(wrd, curr); if(fnd>=0) { ans++; curr=fnd+1; } else { break; } } } Console.WriteLine(ans); } public class Reader { public static bool IsDebug = true; private static System.IO.StringReader SReader; private static string InitText = @" ABAACABCAACBABABACBBAC 7 A C AA ABB ABA BA CBBAC "; public static string ReadLine() { if(IsDebug) { if(SReader == null) { SReader = new System.IO.StringReader(InitText.Trim()); } return SReader.ReadLine(); } else { return Console.ReadLine(); } } } public static void Main(string[] args) { Program prg = new Program(); prg.Proc(); } }