ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1567. SMS-spam

С# Solution
Posted by zak427 11 Jul 2016 14:52
using System;
using System.Linq;

namespace Csharp_1567
{
    class Program
    {
        static void Main(string[] args)
        {
            string str1 = Console.ReadLine();
            uint sum = 0;
            int lin = (from n in str1
                       select n).Count();
            for (int i =0;i<lin;i++)
            {
                if (str1[i] == 'a' || str1[i] == 'd' || str1[i] == 'g' || str1[i] == 'j' || str1[i] == 'm' || str1[i] == 'p' || str1[i] == 's' || str1[i] == 'v' || str1[i] == 'y' || str1[i] == '_' || str1[i] == '.' || str1[i] == ' ')
                {
                    sum += 1;
                    continue;
                }
                else if (str1[i] == 'b' || str1[i] == 'e' || str1[i] == 'h' || str1[i] == 'k' || str1[i] == 'n' || str1[i] == 'q' || str1[i] == 't' || str1[i] == 'w' || str1[i] == 'z' || str1[i] == ',')
                {
                    sum += 2;
                    continue;
                }
                else sum += 3;
            }
            Console.WriteLine(sum);
        }
    }
}
Re: С# Solution
Posted by PO 26 Jan 2019 11:47
that's a verbose one :)