// Nurstan Duisengaliev(REALBOY)
// не, не надо меня узнавать
/*#pragma GCC target ("avx2")
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimize("O3")*/
#include <bits/stdc++.h>
#define ll long long
#define all(x) x.begin(), x.end()
#define in insert
#define mp make_pair
#define F first
#define S second
#define ppf pop_front
#define pb push_back
#define ppb pop_back
#define pf push_front
#define pii pair <int, int>
#define pll pair <ll, ll>
#define boost() ios_base::sync_with_stdio(0), cin.tie(0)
#define sz(x) (int)x.size()
using namespace std;
const int N = (int)2e5 + 123;
const int mod = (int)1e9 + 7;
const ll INF = (ll)1e18 + 1;
string a;
map <string, bool> m;
void solve () {
cin >> a;
int ans = 0;
string s = "";
for (int i = 0; i < sz (a); i ++) {
if ('0' <= a[i] && a[i] <= '9') {
s += a[i];
}
else {
//cout << s << endl;
if (sz (s) != 0 && m[s] == 0) {
ans ++;
m[s] = 1;
}
s = "";
}
}
if (sz (s) != 0 && m[s] == 0) {
ans ++;
m[s] = 1;
}
cout << ans;
}
main () {
// freopen (".in", "r", stdin);
// freopen (".out", "w", stdout);
boost ();
int TT = 1;
// cin >> TT;
while (TT --) {
solve ();
}
return 0;
}
Compilation message
Main.cpp:57:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
57 | main () {
| ^
# |
결과 |
실행 시간 |
메모리 |
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 |
1 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 |
1 ms |
364 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |