Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Text.RegularExpressions;
- namespace RageQuit
- {
- class Program
- {
- static void Main(string[] args)
- {
- var collection = Regex.Matches(Console.ReadLine(), @"([^0-9]+)(\d*)");
- Console.WriteLine("Unique symbols used: {1}\n{0}", string.Join("", collection
- .Cast<Match>()
- .Select(m => string.Join("", (Enumerable.Repeat(m.Groups[1].ToString().ToUpper(), int.Parse(m.Groups[2].ToString())))))
- .ToList()), new string(string.Join("", collection.Cast<Match>().Where(y => y.Groups[2].ToString() != "0").Select(x => x.Groups[1].ToString().ToUpper()).ToArray()).Distinct().ToArray()).Count());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement