Advertisement
nmnikolov

02. LettersSymbolsNumbers

Jul 25th, 2014
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.06 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. class LettersSymbolsNumbers
  8. {
  9.     static void Main()
  10.     {
  11.         int n = int.Parse(Console.ReadLine());
  12.         int letters = 0;
  13.         int numbers = 0;
  14.         int symbols = 0;
  15.         string input = string.Empty;
  16.  
  17.         for (int i = 0; i < n; i++)
  18.         {
  19.             input += string.Join("", Console.ReadLine().ToUpper().Split(new char[] { ' ', '\t', '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries));
  20.         }
  21.  
  22.         foreach (char s in input)
  23.         {
  24.             if (s >= 'A' && s <= 'Z')
  25.             {
  26.                 letters += ((int)s - 64)*10;
  27.             }
  28.             else if (s >= '0' && s <= '9')
  29.             {
  30.                 numbers += (int)char.GetNumericValue(s)*20;
  31.             }
  32.             else
  33.             {
  34.                 symbols += 200;
  35.             }
  36.            
  37.         }
  38.         Console.WriteLine(letters);
  39.         Console.WriteLine(numbers);
  40.         Console.WriteLine(symbols);
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement