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;
- using System.Threading.Tasks;
- namespace DomashniPractice
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- int character;
- int numbers = 0;
- int bigletters = 0;
- int smallLetters = 0;
- int otherSymbols = 0;
- string numbers1 = "";
- string bigletters1 = "";
- string smallLetters1 = "";
- string otherSymbols1 = "";
- for (int i = 0; i < n; i++)
- {
- character = Char.Parse(Console.ReadLine());
- if ((int)character >= 48 && (int)character <= 57)
- {
- numbers += character;
- numbers1 += (char)character;
- }
- else if ((int)character >= 65 && (int)character <= 90)
- {
- bigletters += character;
- bigletters1 += (char)character;
- }
- else if ((int)character >= 97 && (int)character <= 122)
- {
- smallLetters += character;
- smallLetters1 += (char)character;
- }
- else
- {
- otherSymbols += character;
- otherSymbols1 += (char)character;
- }
- }
- if ((numbers != 0 && numbers == bigletters) || (numbers != 0 && numbers == smallLetters) || (numbers != 0 && numbers == otherSymbols))
- {
- Console.WriteLine("Biggest ASCII sum is:" + numbers);
- Console.WriteLine("Combination of characters is:" + numbers1);
- }
- else if ((bigletters != 0 && bigletters == smallLetters) || (bigletters != 0 && bigletters == otherSymbols))
- {
- Console.WriteLine("Biggest ASCII sum is:" + bigletters);
- Console.WriteLine("Combination of characters is:" + bigletters1);
- }
- else if (smallLetters != 0 && smallLetters == otherSymbols)
- {
- Console.WriteLine("Biggest ASCII sum is:" + smallLetters);
- Console.WriteLine("Combination of characters is:" + smallLetters1);
- }
- else
- {
- Console.WriteLine("Biggest ASCII sum is:" + Math.Max(Math.Max(Math.Max((int)numbers, (int)bigletters), (int)smallLetters), (int)otherSymbols));
- if(Math.Max(Math.Max(Math.Max((int)numbers, (int)bigletters), (int)smallLetters), (int)otherSymbols) == numbers)
- {
- Console.WriteLine("Combination of characters is:" + numbers1);
- }
- else if (Math.Max(Math.Max(Math.Max((int)numbers, (int)bigletters), (int)smallLetters), (int)otherSymbols) == bigletters)
- {
- Console.WriteLine("Combination of characters is:" + bigletters1);
- }
- else if (Math.Max(Math.Max(Math.Max((int)numbers, (int)bigletters), (int)smallLetters), (int)otherSymbols) == smallLetters)
- {
- Console.WriteLine("Combination of characters is:" + smallLetters1);
- }
- else
- {
- Console.WriteLine("Combination of characters is:" + otherSymbols1);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement