Digit Hackerearth

code:

#include<bits/stdc++.h>
using namespace std;
const int N=2e5+55; //max range 10^9
int cnt;
string str;
int main()
{
    cin>>str;
    for(int i=0;str[i]!='\0';i++)
    {
        if(str[i]>=0 || str[i]<=9)
        {
            cnt++;
        }
    }
    cout<<cnt<<endl;

    return 0;
}

 

It would be a great help, if you support by sharing :)
Author: zakilive

Leave a Reply

Your email address will not be published. Required fields are marked *