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

Solution c++
Posted by Ivan 27 Sep 2019 19:12
#include <iostream>
#include <string>

using namespace std;

int main()
{string s;
 int o=0;
 getline(cin, s);
 string b1 = "adgjmpsvy. ";
 string b2 = "behknqtwz,";
 string b3 = "cfilorux!";
 for (int k=0; k<s.size();k++)
    {
        if (b1.find(s[k]) != string::npos)
            o++;
        if (b2.find(s[k]) != string::npos)
            o+=2;
        if (b3.find(s[k]) != string::npos)
            o+=3;
    }
    cout<<o;
return 0;
}