Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Text;
- using System.Text.RegularExpressions;
- namespace Rage_Quit_v3._0
- {
- class Program
- {
- static void Main(string[] args)
- {
- Regex pattern = new Regex(@"(\D+)(\d+)");
- string input = Console.ReadLine().ToUpper();
- var result = new List<string>();
- var charsUsed = new List<char>();
- int counter = 0;
- foreach (Match item in pattern.Matches(input))
- {
- int count = int.Parse(item.Groups[2].Value);
- string word = item.Groups[1].Value;
- for (int i = 0; i < count; i++) result.Add(word);
- foreach (char Char in item.Groups[1].Value)
- {
- if (!charsUsed.Contains(Char))
- {
- charsUsed.Add(Char);
- counter++;
- }
- }
- }
- Console.WriteLine($"Unique symbols used: {counter}");
- Console.WriteLine(string.Join("", result));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement