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 ForthExam
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- int digitSum = 0;
- int smallLettersSum = 0;
- int bigLetterSum = 0;
- int otherSum = 0;
- string digit = null;
- string smallLetters = null;
- string bigLetters = null;
- string otherSymbols = null;
- for (int i = 0; i < n; i++)
- {
- char symbol = char.Parse(Console.ReadLine());
- if (symbol >= '0' && symbol <= '9')
- {
- digitSum += (int)symbol;
- digit += symbol;
- }
- else if (symbol >= 'a' && symbol <= 'z')
- {
- smallLettersSum += (int)symbol;
- smallLetters += symbol;
- }
- else if (symbol >= 'A' && symbol <= 'Z')
- {
- bigLetterSum += (int)symbol;
- bigLetters += symbol;
- }
- else
- {
- otherSum += (int)symbol;
- otherSymbols += symbol;
- }
- }
- if (digitSum >= smallLettersSum && digitSum >= bigLetterSum && digitSum >= otherSum)
- {
- Console.WriteLine("Biggest ASCII sum is:{0}", digitSum);
- Console.WriteLine("Combination of characters is:{0}", digit);
- }
- else if (bigLetterSum >= smallLettersSum && bigLetterSum >= otherSum )
- {
- Console.WriteLine("Biggest ASCII sum is:{0}", bigLetterSum);
- Console.WriteLine("Combination of characters is:{0}", bigLetters);
- }
- else if (smallLettersSum >= otherSum)
- {
- Console.WriteLine("Biggest ASCII sum is:{0}", smallLettersSum);
- Console.WriteLine("Combination of characters is:{0}", smallLetters);
- }
- else
- {
- Console.WriteLine("Biggest ASCII sum is:{0}", otherSum);
- Console.WriteLine("Combination of characters is:{0}", otherSymbols);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement