Submission #1131774

#TimeUsernameProblemLanguageResultExecution timeMemory
1131774lopkusSifra (COCI21_sifra)C++20
50 / 50
0 ms328 KiB
#include <bits/stdc++.h>

#define int long long

using namespace std;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string a;
    cin >> a;
    int n = a.size();
    a = ' ' + a;
    map<string, int> M;
    for(int i = 1; i <= n;) {
        if(a[i] >= '0' && a[i] <= '9') {
            int idx = i;
            for(int j = i + 1; j <= n; j++) {
                if(a[j] >= '0' && a[j] <= '9') {
                    idx = j;
                }
                else {
                    break;
                }
            }
            string c = "";
            for(int j = i; j <= idx; j++) {
                c += a[j];
            }
            M[c] += 1;
            i = idx + 1;
        }
        else {
            i += 1;
        }
    }
    cout << M.size();
}
#Verdict Execution timeMemoryGrader output
Fetching results...