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;
- using System.Threading.Tasks;
- namespace PotokOtBukvi
- {
- class Program
- {
- static void Main(string[] args)
- {
- string cod = "";
- int countC = 0;
- int countO = 0;
- int countN = 0;
- int count = 0;
- bool isFirstSecretLetter = false;
- string comand = Console.ReadLine();
- while (comand != "End")
- {
- char letter = char.Parse(comand);
- if ((letter>='a'&& letter<='z') || (letter >= 'A' && letter <= 'Z'))
- {
- if (letter=='c' &&countC < 1 )
- {
- countC++;
- count++;
- isFirstSecretLetter = true;
- }
- else if (letter == 'o' && countO < 1)
- {
- countO++;
- count++;
- isFirstSecretLetter = true;
- }
- else if (letter == 'n' && countN < 1)
- {
- countN++;
- count++;
- isFirstSecretLetter = true;
- }
- if (count==3)
- {
- Console.Write($"{cod} ");
- count = 0;
- countC = 0;
- countO = 0;
- countN = 0;
- cod = "";
- }
- else if (isFirstSecretLetter==false)
- {
- cod += letter;
- }
- isFirstSecretLetter = false;
- }
- comand = Console.ReadLine();
- }
- if (comand=="End" && count==3)
- {
- Console.WriteLine($"{cod}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement