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

GOT AC, all genius is simple
Posted by son1g 28 Jun 2011 13:00
#include<iostream>
#include<math.h>
#include<conio.h>
#include<string>

using namespace std;

int main() {
 char s;
 int count = 0;
 cin >> noskipws;
 while (cin >> s) {
    if ((s=='a')||
        (s=='d')||
        (s=='g')||
        (s=='j')||
        (s=='m')||
        (s=='p')||
        (s=='s')||
        (s=='v')||
        (s=='y')||
        (s=='.')||
        (s==' ')) {count+=1;}
    if ((s=='b')||
        (s=='e')||
        (s=='h')||
        (s=='k')||
        (s=='n')||
        (s=='q')||
        (s=='t')||
        (s=='w')||
        (s=='z')||
        (s==',')) {count+=2;}
    if ((s=='c')||
        (s=='f')||
        (s=='i')||
        (s=='l')||
        (s=='o')||
        (s=='r')||
        (s=='u')||
        (s=='x')||
        (s=='!')) {count+=3;}
 }
 cout << count;
 getch();
 return 0;
}

PS I wanted to use "(int(s)-97)%3".