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;
- using System.Text.RegularExpressions;
- namespace _06_replace_repeating_characters//100/100
- {
- class Program
- {
- static void Main(string[] args)
- {
- string input = Console.ReadLine();
- var prevChar = '\0';
- StringBuilder sb = new StringBuilder();
- foreach (char chr in input)
- {
- if (chr != prevChar)
- {
- sb.Append(chr);
- prevChar = chr;
- }
- }
- Console.WriteLine(sb);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement