Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace RageQuit_MoreEx
- {
- class Program
- {
- static void Main(string[] args)
- {
- string text = Console.ReadLine().ToUpper();
- string partText = "";
- StringBuilder builder = new StringBuilder();
- for (int i = 0; i < text.Length; i++)
- {
- if (!char.IsDigit(text[i]))
- {
- partText += text[i];
- }
- else if (char.IsDigit(text[i]))
- {
- string number = text[i].ToString();
- if (i + 1 < text.Length)
- {
- if (char.IsDigit(text[i + 1]))
- {
- number += text[i + 1];
- i += 1;
- }
- }
- int counter = int.Parse(number);
- for (int j = 0; j < counter; j++)
- {
- builder.Append(partText);
- }
- partText = "";
- }
- }
- StringBuilder textNoDigit = new StringBuilder();
- for (int i = 0; i < text.Length; i++)
- {
- if (!char.IsDigit(text[i]))
- {
- textNoDigit.Append(text[i]);
- }
- }
- for (int i = 0; i < textNoDigit.Length; i++)
- {
- for (int j = i + 1; j < textNoDigit.Length; j++)
- {
- if (textNoDigit[i] == textNoDigit[j])
- {
- textNoDigit.Remove(j, 1);
- }
- }
- }
- Console.WriteLine($"Unique symbols used: {textNoDigit.Length}");
- Console.WriteLine(builder);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement