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;
- class Program
- {
- static void Main(string[] args)
- {
- string user = Console.ReadLine().ToUpper();
- StringBuilder result = new StringBuilder();
- int index = 0;
- while (true)
- {
- StringBuilder currentWord = new StringBuilder();
- StringBuilder currentRepeatCount = new StringBuilder();
- int repeatCount = 0;
- for (int i = index; i < user.Length; i++)
- {
- if (Char.IsDigit(user[i]))
- {
- currentRepeatCount.Append(user[i]);
- int j;
- for (j = i+1; j < user.Length; j++)
- {
- if (Char.IsDigit(user[j]))
- {
- currentRepeatCount.Append(user[j]);
- }
- else
- break;
- }
- repeatCount = int.Parse(currentRepeatCount.ToString());
- index = j;
- break;
- }
- else
- currentWord.Append(user[i]);
- }
- for (int i = 0; i < repeatCount; i++)
- {
- result.Append(currentWord.ToString());
- }
- if (index >= user.Length-1)
- {
- break;
- }
- }
- HashSet<char> uniqueChars = new HashSet<char>(result.ToString().ToArray());
- Console.WriteLine($"Unique symbols used: {uniqueChars.Count}");
- Console.WriteLine($"{result.ToString()}");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement