Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Text.RegularExpressions;
- using System.Linq;
- namespace exam_prep_III_3
- {
- class Program
- {
- static void Main(string[] args)
- {
- string line = Console.ReadLine();
- var regex = "([^0-9]+)(\\d+)";
- var matches = Regex.Matches(line, regex);
- var strings = string.Join("",matches.Select(x => x.Groups[1].Value).ToArray());
- Console.WriteLine($"Unique symbols used: {strings.ToLower().Distinct().Count()}");
- foreach (Match match in matches)
- {
- var text = match.Groups[1].Value;
- var number = int.Parse(match.Groups[2].Value);
- Console.Write(string.Concat(Enumerable.Repeat(text.ToUpper(), number)));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement