|
|
вернуться в форумМоё решение/My Solution C# Послано Toriki 16 окт 2017 23:12 using System; namespace SMSSpam { class Program { static void Main(string[] args) { string spam = Console.ReadLine(); Console.WriteLine(spamPrice(spam.ToLower())); Console.ReadKey(); } static int spamPrice (string spam) { int price = 0; foreach (char letter in spam) { price += LetterPrice(letter); } return price; } static int LetterPrice (char letter) { string charSet = "abcdefghijklmnopqrstuvwxyz*.,! "; return (charSet.IndexOf(letter) % 3) + 1; } } } |
|
|