// This code is written by _L__
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.2,popcnt,abm,mmx,avx2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-funroll-all-loops,-fpeel-loops,-funswitch-loops")
using namespace std;
#define endl '\n'
#define F_word ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
typedef long long ll;
typedef long double ld;
const ll mod = 1e9+7, N = 2e5, inf = 1e11;
const ld E = 1e-6;
#define ff first
#define ss second
int main(void){
F_word;
string s; cin >> s;
bool f = 1;
set<string> st;
string ans = "";
for(int i = 0; i < s.size(); ++i){
if(s[i] >= 'a' && s[i] <= 'z'){
if(ans.size()){
st.insert(ans);
ans = "";
}
} else {
ans += s[i];
}
}
if(ans.size()) st.insert(ans);
cout << st.size() << endl;
}
Compilation message
Main.cpp: In function 'int main()':
Main.cpp:23:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
23 | for(int i = 0; i < s.size(); ++i){
| ~~^~~~~~~~~~
Main.cpp:20:10: warning: unused variable 'f' [-Wunused-variable]
20 | bool f = 1;
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
9 |
Correct |
0 ms |
204 KB |
Output is correct |
10 |
Correct |
0 ms |
204 KB |
Output is correct |