Advertisement
Guest User

Untitled

a guest
Mar 21st, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace string_6
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. string sequence = Console.ReadLine();
  14. var finalstring = new StringBuilder();
  15. finalstring.Append(sequence[0]);
  16. for (int i = 0; i < sequence.Length - 1; i++)
  17. {
  18. if (sequence[i] != sequence[i + 1])
  19. {
  20. finalstring.Append(sequence[i + 1]);
  21. }
  22. }
  23. Console.WriteLine(finalstring);
  24. }
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement