Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Text;
- class Program
- {
- static void Main()
- {
- string str = Console.ReadLine();
- int count = 0;
- int counts=0;
- StringBuilder sb = new StringBuilder();
- for (int i = 0; i < str.Length-1; i++)
- {
- counts++;
- if (str[i] == str[i + 1])
- {
- do
- {
- count++;
- } while (str[i] != str[i+1]);
- }
- if (count < counts)
- {
- sb.Append(str[i]);
- count = 0;
- counts = 0;
- }
- }
- Console.Write(sb);
- Console.WriteLine(str[str.Length - 1]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement