Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- class Program
- {
- static void Main()
- {
- int n = int.Parse(Console.ReadLine());
- string input = "";
- string alphabet = " abcdefghijklmnopqrstuvwxyz";
- int lettersSum = 0;
- int numbersSum = 0;
- int symbolsSum = 0;
- for (int i = 0; i < n; i++)
- {
- input += Console.ReadLine().ToLower();
- }
- char[] delimiterChars = { ' ', '\t', '\n', '\r' };
- string[] splittedInput = input.Split(delimiterChars);
- string stringToCount = "";
- foreach (string symbol in splittedInput)
- {
- stringToCount += symbol;
- }
- for (int i = 0; i < stringToCount.Length; i++)
- {
- int digit = 0;
- bool checkIsDigit = Int32.TryParse(stringToCount[i].ToString(), out digit);
- if (alphabet.Contains(stringToCount[i]))
- {
- lettersSum += (alphabet.IndexOf(stringToCount[i]) * 10);
- }
- else if (checkIsDigit)
- {
- numbersSum += (digit * 20);
- }
- else
- {
- if (stringToCount[i].ToString() != string.Empty)
- {
- symbolsSum += 200;
- }
- }
- }
- Console.WriteLine(lettersSum);
- Console.WriteLine(numbersSum);
- Console.WriteLine(symbolsSum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement