Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdio>
- #include <cctype>
- #include <algorithm>
- using namespace std;
- long long mapeiaLetras(string frase){
- long long tot = 0;
- int i;
- for(i=0;i<frase.length();i++){
- if(frase[i]=='a' || frase[i]=='d' || frase[i]=='g' || frase[i]=='j'
- || frase[i]=='m' || frase[i]=='p' || frase[i]=='t' || frase[i]=='w'
- || frase[i]==' '){
- tot+=1;
- }
- if(frase[i]=='b' || frase[i]=='e' || frase[i]=='h' || frase[i]=='k'||
- frase[i]=='n' || frase[i]=='q' || frase[i]=='u' || frase[i]=='x'){
- tot+=2;
- }
- if(frase[i]=='c' || frase[i]=='f' || frase[i]=='i' || frase[i]=='l'||
- frase[i]=='o' || frase[i]=='r' || frase[i]=='v' || frase[i]=='y'){
- tot+=3;
- }
- if(frase[i]=='s' || frase[i]=='z'){
- tot+=4;
- }
- }
- return tot;
- }
- int main()
- {
- string frase;
- int t,caso=1;
- cin>>t;
- getchar();
- while(t--){
- getline(cin,frase);
- long long resp = mapeiaLetras(frase);
- printf("Case #%d: %llu\n",caso,resp);
- caso++;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement