Advertisement
Guest User

Untitled

a guest
Dec 7th, 2019
1,047
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. using System;
  2.  
  3. namespace streamOfLetters
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. string symbol = Console.ReadLine();
  10.  
  11. int counterC = 0;
  12. int counterO = 0;
  13. int counterN = 0;
  14. string word = string.Empty;
  15. string secredWord = string.Empty;
  16.  
  17.  
  18. while (symbol != "End")
  19. {
  20.  
  21. char letter = char.Parse(symbol);
  22.  
  23. if (letter >= 'a' && letter <= 'z' || letter >= 'A' && letter <= 'Z')
  24. {
  25. if (symbol == "c" && counterC == 0)
  26. {
  27. counterC++;
  28. }
  29. else if (symbol == "o" && counterO == 0)
  30. {
  31. counterO++;
  32. }
  33. else if (symbol == "n" && counterN == 0)
  34. {
  35. counterN++;
  36. }
  37. else
  38. {
  39. word += letter;
  40. }
  41. if (counterC + counterN + counterO == 3)
  42. {
  43. secredWord += word;
  44. secredWord += ' ';
  45. word = string.Empty;
  46. counterO = 0;
  47. counterC = 0;
  48. counterN = 0;
  49. }
  50.  
  51. }
  52.  
  53. symbol = Console.ReadLine();
  54. }
  55.  
  56. Console.WriteLine(secredWord);
  57.  
  58. }
  59. }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement