Advertisement
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;
- namespace Extended
- {
- class Program
- {
- static StringBuilder sb = new StringBuilder();
- public static void Main(string[] args)
- {
- string reg = @"(?<text>\D+)(?<count>\d+)";
- var input = Console.ReadLine();
- var match = Regex.Matches(input, reg);
- foreach (Match item in match)
- {
- string text = item.Groups["text"].Value;
- int count = int.Parse(item.Groups["count"].Value);
- Repeat(text, count);
- }
- string res = sb.ToString().ToUpper();
- Console.WriteLine("Unique symbols used: {0}", res.Distinct().Count());
- Console.WriteLine(res);
- }
- private static void Repeat(string text, int repeatCount)
- {
- for (int i = 0; i < repeatCount; i++)
- {
- sb.Append(text);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement