Advertisement
daxtera

Untitled

Mar 26th, 2019
331
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace _10.Rage_Quit
  7. {
  8. class Program
  9. {
  10. static void Main(string[] args)
  11. {
  12. string input = Console.ReadLine().ToUpper();
  13. List<char> nonRepeatedSymbols = input.Where(x => !char.IsDigit(x)).Distinct().ToList();
  14. Console.WriteLine($"Unique symbols used: {nonRepeatedSymbols.Count}");
  15.  
  16. typeRepeatedStrings(input);
  17.  
  18.  
  19. }
  20.  
  21. private static void typeRepeatedStrings(string input)
  22. {
  23. List<char> uniqueSymbols = new List<char>();
  24.  
  25. StringBuilder currentString = new StringBuilder();
  26.  
  27. for (int i = 0; i < input.Length; i++)
  28. {
  29. if (!char.IsDigit(input[i]))
  30. {
  31. currentString.Append(input[i]);
  32. }
  33. else if (char.IsDigit(input[i]))
  34. {
  35. for (int j = 0; j < char.GetNumericValue(input[i]); j++)
  36. {
  37. Console.Write(currentString);
  38. }
  39. currentString.Clear();
  40. }
  41. }
  42. }
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement