Advertisement
dradoslavov89

Untitled

Nov 16th, 2018
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace _06._Replace_Repeating_Chars
  5. {
  6. class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10. string Word = Console.ReadLine();
  11. List<char> notDuplicate = new List<char>();
  12. for (int i = 0; i < Word.Length-1; i+=2)
  13. {
  14.  
  15. char symbol = Word[i];
  16. char symbolCheck = Word[i + 1];
  17. if (symbol==symbolCheck)
  18. {
  19. continue;
  20. }
  21. else
  22. {
  23. notDuplicate.Add(symbol);
  24. }
  25.  
  26.  
  27.  
  28. }
  29. for (int i = Word.Length-1; i < Word.Length; i++)
  30. {
  31. char symbol = Word[i];
  32. notDuplicate.Add(symbol);
  33.  
  34. }
  35.  
  36.  
  37.  
  38. Console.WriteLine(string.Join("",notDuplicate));
  39. }
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement