#include <bits/stdc++.h>
#define pb push_back
#define whole(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using namespace std;
typedef long long ll;
typedef long double ld;
const int N = (int)2e6 + 8;
const int INF = (int)1e9 + 7;
const ll linf = (ll)1e15 + 2;
map<string, bool> was;
int cnt;
string cur;
void upd() {
if (!cur.empty()) {
if (!was[cur]) ++cnt, was[cur] = 1;
cur = "";
}
}
int main() {
string s; cin >> s;
int n = sz(s);
for (int i = 0; i < n; ++i) {
if ('a' <= s[i] && s[i] <= 'z') {
if (!cur.empty()) upd();
continue;
}
if (sz(cur) == 3) upd();
cur += s[i];
}
upd();
cout << cnt << "\n";
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
0 ms |
364 KB |
Output is correct |
7 |
Correct |
1 ms |
364 KB |
Output is correct |
8 |
Correct |
1 ms |
364 KB |
Output is correct |
9 |
Correct |
0 ms |
364 KB |
Output is correct |
10 |
Correct |
0 ms |
364 KB |
Output is correct |