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;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- int count = int.Parse(Console.ReadLine());
- int lettersSum = 0;
- int SymbolsSum = 0;
- int digitsSum = 0;
- for (int i = 0; i < count; i++)
- {
- string currentString = Console.ReadLine().ToLower();
- // foreach (var ch in currentString) // tozi string moje da se obhodi i s FOREACH
- for (int j = 0; j < currentString.Length; j++)
- {
- char ch = currentString[j];
- if (ch != ' ' && ch != '\t' && ch != '\r' && ch != '\n')
- {
- if (ch >= 'a' && ch <= 'z')
- {
- int weight = ((ch - 'a') + 1) * 10;// vadim chara - a i pribavqme 1 zashtoto a = 97 - c= 99 i se polu4ava 2 a na men mi trqbv ada e 3
- lettersSum += weight;
- }
- else if (ch >= '0' && ch <= '9')
- {
- int weight = (ch - '0') * 20;
- digitsSum += weight;
- }
- else
- {
- SymbolsSum += 200;
- }
- }
- }
- }
- Console.WriteLine(lettersSum);
- Console.WriteLine(digitsSum);
- Console.WriteLine(SymbolsSum);
- }
- }
- }
- /* if (ch != ' ' || ch != '\t' || ch != '\r' || ch != '\n')
- {
- lettersSum += 0;
- SymbolsSum += 0;
- digitsSum += 0;
- }
- else if (ch >= 'a' && ch <= 'z')
- {
- int weight = (ch - 'a' + 1) * 10;
- lettersSum += weight;
- }
- else if (ch >= '0' && ch <= '9')
- {
- int weight = (ch - '0') * 20;
- digitsSum += weight;
- }
- else
- {
- SymbolsSum += 200;
- } */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement