Advertisement
ss3434

Untitled

Oct 17th, 2019
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 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.  
  7. namespace PotokOtBukvi
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. string cod = "";
  14. int countC = 0;
  15. int countO = 0;
  16. int countN = 0;
  17. int count = 0;
  18. bool isFirstSecretLetter = false;
  19.  
  20. string comand = Console.ReadLine();
  21.  
  22. while (comand != "End")
  23. {
  24. char letter = char.Parse(comand);
  25.  
  26. if ((letter>='a'&& letter<='z') || (letter >= 'A' && letter <= 'Z'))
  27. {
  28. if (letter=='c' &&countC < 1 )
  29. {
  30. countC++;
  31. count++;
  32. isFirstSecretLetter = true;
  33. }
  34. else if (letter == 'o' && countO < 1)
  35. {
  36. countO++;
  37. count++;
  38. isFirstSecretLetter = true;
  39. }
  40. else if (letter == 'n' && countN < 1)
  41. {
  42. countN++;
  43. count++;
  44. isFirstSecretLetter = true;
  45. }
  46. if (count==3)
  47. {
  48. Console.Write($"{cod} ");
  49. count = 0;
  50. countC = 0;
  51. countO = 0;
  52. countN = 0;
  53. cod = "";
  54. }
  55. else if (isFirstSecretLetter==false)
  56. {
  57. cod += letter;
  58. }
  59. isFirstSecretLetter = false;
  60. }
  61. comand = Console.ReadLine();
  62. }
  63. if (comand=="End" && count==3)
  64. {
  65. Console.WriteLine($"{cod}");
  66. }
  67. }
  68. }
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement