Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Text;
- using System.Text.RegularExpressions;
- namespace _14_ExamPreparation3
- {
- class Program
- {
- static void Main(string[] args)
- {
- string input = Console.ReadLine();
- string pattern = @"([^\d]+)(\d+)";
- StringBuilder sb = new StringBuilder();
- MatchCollection matches = Regex.Matches(input, pattern);
- foreach (Match match in matches)
- {
- string str = match.Groups[1].ToString().ToUpper();
- int charCount = int.Parse(match.Groups[2].ToString());
- for (int i = 0; i < charCount; i++)
- {
- sb.Append(str);
- }
- }
- var count = sb.ToString().Distinct().Count();
- Console.WriteLine($"Unique symbols used: {count}");
- Console.WriteLine(sb);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement