Advertisement
dradoslavov89

Untitled

Nov 16th, 2018
134
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.  
  4. namespace _06._Replace_Repeating_Chars
  5. {
  6. class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10. string word = Console.ReadLine();
  11.  
  12. string remove = RemoveDuplicateChars(word);
  13. Console.WriteLine(remove);
  14. }
  15. static string RemoveDuplicateChars(string word)
  16. {
  17.  
  18. string result = "";
  19.  
  20. foreach (char value in word)
  21. {
  22. if (result.IndexOf(value) == -1)
  23. {
  24.  
  25. result += value;
  26. }
  27. }
  28. return result;
  29. }
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement