Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _02.Count_Substring_Occurrences
- {
- class Program
- {
- static void Main(string[] args)
- {
- string text = Console.ReadLine().ToLower();
- string pattern = Console.ReadLine().ToLower();
- int count = 0;
- int index = text.IndexOf(pattern);
- while (index != -1)
- {
- count++;
- index = text.IndexOf(pattern, index + 1);
- }
- Console.WriteLine(count);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement