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 string_6
- {
- class Program
- {
- static void Main(string[] args)
- {
- string sequence = Console.ReadLine();
- var finalstring = new StringBuilder();
- finalstring.Append(sequence[0]);
- for (int i = 0; i < sequence.Length - 1; i++)
- {
- if (sequence[i] != sequence[i + 1])
- {
- finalstring.Append(sequence[i + 1]);
- }
- }
- Console.WriteLine(finalstring);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement