Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace _06._Replace_Repeating_Chars
- {
- class Program
- {
- static void Main(string[] args)
- {
- string Word = Console.ReadLine();
- List<char> notDuplicate = new List<char>();
- for (int i = 0; i < Word.Length-1; i+=2)
- {
- char symbol = Word[i];
- char symbolCheck = Word[i + 1];
- if (symbol==symbolCheck)
- {
- continue;
- }
- else
- {
- notDuplicate.Add(symbol);
- }
- }
- for (int i = Word.Length-1; i < Word.Length; i++)
- {
- char symbol = Word[i];
- notDuplicate.Add(symbol);
- }
- Console.WriteLine(string.Join("",notDuplicate));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement