Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Globalization;
- using System.Linq;
- using System.Threading;
- public class LettersSymbolsNumbers
- {
- private static Dictionary<char, int> alphabet = new Dictionary<char, int>()
- {
- { 'A', 10 }, { 'B', 20 }, { 'C', 30 }, { 'D', 40 }, { 'E', 50 }, { 'F', 60 }, { 'G', 70 },
- { 'H', 80 }, { 'I', 90 }, { 'J', 100 }, { 'K', 110 }, { 'L', 120 }, { 'M', 130 }, { 'N', 140 },
- { 'O', 150 }, { 'P', 160 }, { 'Q', 170 }, { 'R', 180 }, { 'S', 190 }, { 'T', 200 },
- { 'U', 210 }, { 'V', 220 }, { 'W', 230 }, { 'X', 240 }, { 'Y', 250 }, { 'Z', 260 }
- };
- private static char[] whitespaceSymbs = { ' ', '\t', '\r', '\n' };
- public static void Main()
- {
- Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
- checked
- {
- int countOfStrings = int.Parse(Console.ReadLine());
- int sumOfLetters = 0;
- int sumOfNums = 0;
- int sumOfSymbols = 0;
- if (countOfStrings > 0)
- {
- for (int i = 0; i < countOfStrings; i++)
- {
- string inputString = Console.ReadLine().ToUpper();
- for (int j = 0; j < inputString.Length; j++)
- {
- char current = inputString[j];
- if (alphabet.ContainsKey(current))
- {
- sumOfLetters += alphabet[current];
- }
- else if (char.IsDigit(current))
- {
- int digit = int.Parse(current.ToString());
- sumOfNums += digit * 20;
- }
- else if (!whitespaceSymbs.Contains(current))
- {
- sumOfSymbols += 200;
- }
- }
- }
- }
- Console.WriteLine("{0}\n{1}\n{2}", sumOfLetters, sumOfNums, sumOfSymbols);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement