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

WA - но почему?!
Posted by deamont 26 Mar 2013 18:24
#include <iostream>

int ClickCount(char c);

using namespace std;

int main()
{
    char Buf[1001];
    cin.getline(Buf,1001);

    int Result=0;
    int i=0;
    while (Buf[i]!='\0')
    {
        Result+=ClickCount(Buf[i]);
        i++;
    }

    cout << Result;

    //system("pause");

    return 0;
}

int ClickCount(char c)
{
    char AlphaBet[]="abcdefghijklmnopqrstuvwxyz*.,!# *";
    for (int i=0;i<=sizeof AlphaBet;i++)
    {
        if (c==AlphaBet[i]) return i%3+1;
    }
    return 0;
}