Submission #1038280

# Submission time Handle Problem Language Result Execution time Memory
1038280 2024-07-29T15:22:16 Z MrPavlito Sifra (COCI21_sifra) C++17
50 / 50
1 ms 348 KB
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define sc second
#define endl "\n"
#define pii pair<int,int>

using namespace std;

const int MAXN = 1e5+5;
const int mod7 = 1e9+7;
const long long inf = 1e18;

bool isnumber(char c)
{
    if(c=='0')return true;
    if(c=='1')return true;
    if(c=='2')return true;
    if(c=='3')return true;
    if(c=='4')return true;
    if(c=='5')return true;
    if(c=='6')return true;
    if(c=='7')return true;
    if(c=='8')return true;
    if(c=='9')return true;
    return false;
}

signed main()
{
    ios_base::sync_with_stdio(false),cin.tie(0), cout.tie(0);
    int tt=1;
    //cin >> tt;
    while(tt--)
    {
        string s;
        int n;
        cin >> s;
        n = s.size();
        set<string> setic;
        for(int i=0; i<n; i++)
        {
            if(isnumber(s[i]))
            {
                int poz = i;
                while(i<n && isnumber(s[i]))
                {
                    i++;
                }
                i--;
                string novi = s.substr(poz, i-poz+1);
                setic.insert(novi);
            }
        }
        cout << setic.size() << endl;;
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct