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;
- namespace RodeIstDoof {
- class Program {
- static void Main(string[] args) {
- String input, pattern;
- int count = 0, lastIndex = -1;
- Console.Write("Text: ");
- input = Console.ReadLine().ToLower();
- Console.Write("Pattern: ");
- pattern = Console.ReadLine().ToLower();
- while ((lastIndex = input.IndexOf(pattern, lastIndex + 1)) > -1) {
- count++;
- }
- Console.WriteLine("Pattern: {0} {1} times", pattern, count);
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement