제출 #475104

#제출 시각아이디문제언어결과실행 시간메모리
475104HossamHero7Sifra (COCI21_sifra)C++14
50 / 50
1 ms204 KiB
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define endl '\n'
void solve(){
    string s;
    cin>>s;
    s += 'z';
    int n = s.size();
    ll ans = 0;
    ll x = 0;
    map <int,bool> mp;
    bool m = 0;
    for(int i=0;i<n;i++){
        if(s[i] >= '0' && s[i] <= '9'){
            x *= 10;
            x += s[i]-48;
            m = 1;
        }
        else if(m){
            m = 0;
            if(!mp[x]){
                ans ++;
            }
            mp[x] = 1;
            x = 0;
        }
    }
    cout<<ans<<endl;
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);      cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...