Advertisement
VyaraG

LettersNumbersSymbols

Dec 18th, 2014
308
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.25 KB | None | 0 0
  1. using System;
  2.  
  3.  
  4. class LettersSymbolsNumbers
  5. {
  6.     static void Main()
  7.     {
  8.         long numberStrings = long.Parse(Console.ReadLine());
  9.  
  10.         long sumLetters = 0;
  11.         long sumNumbers = 0;
  12.         long sumSymbols = 0;
  13.  
  14.         //loop for the strings to N
  15.         for (int strings = 0; strings < numberStrings; strings++)
  16.         {
  17.             string input  = Console.ReadLine().ToLower().Replace(" ", String.Empty);
  18.  
  19.             //loop for the characters in the string
  20.  
  21.             for (int characters = 0; characters < input.Length; characters++)
  22.             {
  23.                 char currentcharacter =(input[characters]);
  24.  
  25.                 if (currentcharacter >= '0' && currentcharacter <= '9')
  26.                 {
  27.                     sumNumbers += (currentcharacter - '0') * 20;
  28.  
  29.                 }
  30.  
  31.                 else if (currentcharacter>='a' && currentcharacter<= 'z')
  32.                 {
  33.                     sumLetters += (currentcharacter - 'a' + 1) * 10;
  34.                 }
  35.                 else
  36.                 {
  37.                     sumSymbols += 200;
  38.                 }
  39.  
  40.             }
  41.         }
  42.         Console.WriteLine(sumLetters);
  43.         Console.WriteLine(sumNumbers);
  44.         Console.WriteLine(sumSymbols);
  45.     }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement