Submission #1246539

#TimeUsernameProblemLanguageResultExecution timeMemory
1246539rizzful_rulerSifra (COCI21_sifra)C++20
50 / 50
0 ms328 KiB
#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 timeMemoryGrader output
Fetching results...