Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Text;
- namespace RageQuit
- {
- class Program
- {
- static void Main(string[] args)
- {
- string text = Console.ReadLine().ToUpper();
- int index = 0;
- StringBuilder message = new StringBuilder();
- while (index < text.Length)
- {
- string nonDigits = "";
- string digits = "";
- for (int i = 0; i < text.Length; i++)
- {
- while (!char.IsDigit(text[index]))
- {
- nonDigits += text[index];
- index++;
- }
- while (char.IsDigit(text[index]))
- {
- digits += text[index];
- index++;
- if (index == text.Length)
- {
- break;
- }
- }
- int repeatingCount = int.Parse(digits);
- for (int j = 0; j < repeatingCount; j++)
- {
- message.Append(nonDigits);
- }
- if (index == text.Length)
- {
- break;
- }
- nonDigits = "";
- digits = "";
- }
- }
- string rageMessage = message.ToString();
- int uniqueSymbolsCount = rageMessage.Distinct().Count();
- Console.WriteLine($"Unique symbols used: {uniqueSymbolsCount}");
- Console.WriteLine(rageMessage);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement