0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-10 14:38:47 +00:00
OI-codes/Luogu/P1765/P1765.cpp

24 lines
548 B
C++
Raw Normal View History

2020-09-20 09:26:00 +00:00
// R38667223
#include <bits/stdc++.h>
using namespace std;
int num[26] = {1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 4, 1, 2, 3, 1, 2, 3, 4};
2022-05-20 01:23:27 +00:00
2020-09-20 09:26:00 +00:00
// a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v. w, x, y, z
int main() {
char c;
2021-11-19 09:01:13 +00:00
int cnt = 0;
2020-09-20 09:26:00 +00:00
while (scanf("%c", &c) != EOF) {
if (c == ' ') {
cnt++;
2021-11-19 09:01:13 +00:00
} else if ('a' <= c && c <= 'z') {
2020-09-20 09:26:00 +00:00
cnt += num[c - 'a'];
}
// cout << c << ' ' << cnt << endl;
}
cout << cnt << endl;
return 0;
}