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

WHY WA??? if i have rigth answer
Posted by Whiteha 2 Oct 2011 15:35
#include <cstdio>
#include <iostream>
//char str[1001];
char str;
int search(char v)
{
    switch (v)
    {
        case 'a' : return 1; break;
        case 'd' : return 1; break;
        case 'g' : return 1; break;
        case 'j' : return 1; break;
        case 'm' : return 1; break;
        case 'p' : return 1; break;
        case 's' : return 1; break;
        case 'v' : return 1; break;
        case 'y' : return 1; break;
        case '.' : return 1; break;
        case ' ' : return 1; break;

        case 'b' : return 2; break;
        case 'e' : return 2; break;
        case 'h' : return 2; break;
        case 'k' : return 2; break;
        case 'n' : return 2; break;
        case 'q' : return 2; break;
        case 't' : return 2; break;
        case 'w' : return 2; break;
        case 'z' : return 2; break;
        case ',' : return 2; break;

        case 'c' : return 3; break;
        case 'f' : return 3; break;
        case 'i' : return 3; break;
        case 'l' : return 3; break;
        case 'o' : return 3; break;
        case 'r' : return 3; break;
        case 'u' : return 3; break;
        case 'x ': return 3; break;
        case '!' : return 3; break;
    }
    return 0;
}
void main()
{
    int sum = 0;
    //gets(str);
    std::cin>>std::noskipws;
    //for(int i = 0; i < strlen(str) ++i) sum += search(str[i]);
    while (std::cin>>str) sum += search(str);
    printf("%d", sum);
    getchar();
}