Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Text.RegularExpressions;
- using System.Threading.Tasks;
- namespace Anonymous_Vox
- {
- class Program
- {
- static void Main(string[] args)
- {
- string regex = @"(?<str>[^0-9]+)(?<repeat>[0-9]+)";
- string input = Console.ReadLine().ToUpper();
- var matched = Regex.Matches(input, regex);
- var sb = new StringBuilder();
- foreach (Match m in matched)
- {
- for (int i = 0; i < int.Parse(m.Groups["repeat"].Value); i++)
- {
- sb.Append(m.Groups["str"].Value);
- }
- }
- Console.WriteLine($"Unique symbols used: {sb.ToString().Distinct().Count()}");
- Console.WriteLine(sb);
- }
- }
- }
Add Comment
Please, Sign In to add comment