please provide the correction in my code to pass all testcase.
Problem:-Tavas and Saddas
code:-
#include
using namespace std;
#include <math.h>
int numberofdigit(int n)
{
int k=0;
while(n>0)
{
n=n/10;
k++;
}
return k;
}
int main()
{
int n;
cin>>n;
int k=numberofdigit(n);
int x=0;
x+=k*(k-1);
for(int i=0;i<k;i++)
{
int rem=n%10;
if(rem==7)
x+=pow(2,i);
n=n/10;
}
x++;
cout<<x;
return 0;
}