С# Solution
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace phrase
{
class Program
{
static int First(string input, string[]array)
{
int col = Convert.ToInt32(input.Length);
if (col>0&&col<=1000)
{
int countArr = 0,countStr = 0,c = Convert.ToInt32(array.Length),count = 0,indexStr=0;
for (; countArr < c; countArr++)
{
for (; (indexStr = input.IndexOf(array[countArr], countStr)) !=-1; countStr = indexStr + 1)
{
count++;
}
countStr = 0;
}
return count;
}
return 0;
}
static void Main(string[] args)
{
string[] one = new string[] { "a", "d", "g", "j", "m", "p", "s", "v", "y", ".", " " };
string[] two= new string[] { "b", "e", "h", "k", "n", "q", "t", "w", "z", "," };
string[] three = new string[] { "c", "f", "i", "l", "o", "r", "u", "x", "!" };
string input = Console.ReadLine();
int a = First(input,one);
int b = First(input,two);
int c = First(input,three);
Console.WriteLine(a+(b*2)+(c*3));
}
}
}