stefan1919

HackerRankTweets

Oct 9th, 2015
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.94 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. using System.Text.RegularExpressions;
  7. namespace ConsoleApplication6
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int n = int.Parse(Console.ReadLine());
  14.             int counter = 0;
  15.             int occurences = 0;
  16.             List<int> numbers = new List<int>();
  17.             string pattern = @"(hackerrank)";
  18.             Regex regex = new Regex(pattern);
  19.             List<string> output = new List<string>();
  20.             do
  21.             {
  22.                 string input = Console.ReadLine();
  23.                 input = input.ToLower();
  24.                 if (regex.IsMatch(input) == true)
  25.                 {
  26.                     occurences++;
  27.                 }
  28.                 counter++;
  29.             } while (counter < n);
  30.             Console.WriteLine(occurences);
  31.         }
  32.     }
  33. }
Add Comment
Please, Sign In to add comment