Advertisement
kurec

Untitled

Feb 17th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApp3
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. string input = Console.ReadLine().ToLower();
  14. string pattern = Console.ReadLine().ToLower();
  15. int counter = 0;
  16. int index = input.IndexOf(pattern);
  17. while (index != -1)
  18. {
  19. counter++;
  20. index = input.IndexOf(pattern, index + 1);
  21. }
  22. Console.WriteLine(counter);
  23.  
  24. }
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement