#include <iostream>
#include <string>
#include <set>
int main() {
std::string s;
std::cin >> s;
for (auto& c : s) {
if (c >= 'a' && c <= 'z') c = ' ';
}
std::set<std::string> distinct;
std::string temp;
for (char c : s) {
if (c == ' ') {
if (!temp.empty()) {
while (temp.size() > 1 && temp[0] == '0') temp.erase(0, 1);
if (!temp.empty()) distinct.insert(temp);
temp.clear();
}
} else {
temp.push_back(c);
}
}
if (!temp.empty()) {
while (temp.size() > 1 && temp[0] == '0') temp.erase(0, 1);
if (!temp.empty()) distinct.insert(temp);
}
std::cout << distinct.size() << "\n";
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |