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