stefan1919

Saying Hy

Oct 11th, 2015
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 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. List<string> validOrNot = new List<string>();
  16. string pattern = @"^([hi]+\s)(?![D|d]).+";
  17. Regex regex = new Regex(pattern);
  18. do
  19. {
  20. string input = Console.ReadLine();
  21. string check = input.ToLower();
  22. if (regex.IsMatch(check) == true)
  23. {
  24. validOrNot.Add(input);
  25. }
  26. counter++;
  27. } while (counter < n);
  28. foreach (var status in validOrNot)
  29. {
  30. Console.WriteLine(status);
  31. }
  32. }
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment