Advertisement
Guest User

03. Rage Quit

a guest
Dec 30th, 2017
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Text.RegularExpressions;
  6.  
  7. namespace RageQuit
  8. {
  9. class Program
  10. {
  11. static void Main()
  12. {
  13. string user = Console.ReadLine().ToUpper();
  14. Regex test = new Regex(@"(\D+)(\d+)");
  15. StringBuilder result = new StringBuilder();
  16. foreach (Match a in test.Matches(user))
  17. {
  18. StringBuilder res = new StringBuilder();
  19. string txt = a.Groups[1].Value;
  20. int repeat = int.Parse(a.Groups[2].Value);
  21. for (int i = 0; i < repeat; i++)
  22. {
  23. res.Append(txt);
  24. }
  25. result.Append(res);
  26. }
  27. Console.WriteLine("Unique symbols used: {0}",result.ToString().Distinct().Count());
  28. Console.WriteLine(result);
  29. }
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement