Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Text;
- using System.Text.RegularExpressions;
- using System.Linq;
- namespace P10Rage_Quit
- {
- class Program
- {
- static void Main(string[] args)
- {
- string input = Console.ReadLine();
- string regex = @"([^0-9]+[0-9]+)";
- var matches = Regex.Matches(regex, input);
- string textReg = @"[^0-9]+";
- string numReg = @"[0-9]+";
- var result = new StringBuilder();
- foreach (Match match in matches)
- {
- string strMatch = match.ToString();
- Match textMatch = Regex.Match(textReg, strMatch);
- Match numberMatch = Regex.Match(numReg, strMatch);
- int number = int.Parse(numberMatch.ToString());
- for (int i = 0; i < number; i++)
- {
- result.Append(textMatch.ToString());
- }
- }
- string output = result.ToString().ToUpper();
- Console.WriteLine($"Unique symbols used: {output.Distinct().Count()}");
- Console.WriteLine(output);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement