Try some other (more precise) way of counting the number of digits.

now got ac. I just forgot to add 1 with log10()

```
#include<bits/stdc++.h>
using namespace std;
int main(){
char j,k;
string c,d;
int a,b,i,x,y=0,count=0;
cin>>c>>d;
if(c.length()>d.length()){
x=c.length();
y=c.length()-d.length();
}
else{
x=d.length();
y=d.length()-c.length();
}
for(i=y;i<x;i++){
j=c[i];
k=d[i];
a=j-'0';
b=k-'0';
if(a+b>=10){
count++;
}
}
if(count>0){
cout<<"Yes";
}
else{
cout<<"No";
}
return 0;
}
```

getting wrong answer in 2nd last test case

Your code produce wrong answer for input value `1238 7`

is should print `YES`

but it is printing `NO`

Let’s see why you’re getting wrong answer.

In your code for this input value `x = 4`

and `y = 3`

. Then you’re starting the loop from `y`

which is equal to `3`

. then you’re checking the third position of `d`

which is empty because string `d = "7"`

which means that `d[0] = '7'`

and `d[3] = ' '`

so when you’re adding `c[3]+d[3]`

that can give you random value like `-60`

so, that will never become bigger than `10`

and `count`

will not increase and you will get wrong answer.

The correct approach to this problem is first reverse the two string.

this way `reverse(c.begin(), c.end()`

and for the second string `reverse(c.begin(), c.end()`

then run the loop from `0`

to `min(c.length(), d.length())`

I hope this will work. Let us know if there is any problem.

it worked! Thanks for helping me out

You’re Welcome

```
num1,num2=input().split()
x=len(num1)
y=len(num2)
if x<y:
m=x-1
else:
m=y-1
while m>0:
m=m-1
carry=int(num1[m])+int(num2[m])
if carry>9:
checker=1
break
else:
checker=0
if checker==1:
print("Yes")
else:
print("No")
```

it shows wrong answer at 5th test case…but why?

in **line 4-7**

```
if x<y:
m=x-1
else:
m=y-1
```

you are doing **len - 1** here, right? which means **m** is the index of the last character of the strings.

then again in **line 8 - 9**

```
while m>0:
m=m-1
```

you are again doing **m = m - 1**. So, Suppose if **len = 2**, then m becomes 0 here. means that you will miss **m = 1** (the last character).

You are literally forgetting to check the last character of the string here. Your code will fail for simpliest possible inputs or inputs where byang fails to do the sum of the first numbers from the left.

Inputs like these,

```
# Input 1
5 5
# Input 2
126 459
```

Thank’s bro i change it `while m>=0`

now it has been accepted

```
n=True
a,b=map(int, input().split())
a=str(a)
b=str(b)
for i in range(1,len(str(min(a,b)))+1):
if int(a[-i])+int(b[-i])>=10:
n=False
break
print('Yes' if n==False else 'No')
```

It says ‘Runtime error’ in the 5th test.

Well, first of all, The first three lines are unnecessary. the `split()`

method returns a list of strings itself. So, Just try writing this should do,

```
a, b = map(str, input().split()) # or simply,
a, b = input().split()
```

However, if you try to convert them into integer first, you will face **RE**. Python cannot handle such big integers. So, you must handle them as strings.

The Error looks somewhat like this,

```
>>> bigNum = 10 ** 10000 # 10^10000
>>> str = str( bigNum )
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'str' object is not callable
```

Sorry @touhidur vaiya

Couldn’t relate. When I input the same codes in my python shell. The output is something like this-

```
>>> bigNum=10**10000
>>> str=str(bigNum)
>>> print(str)
Squeezed text(126 lines)
```

where clicking on the last line would show me 10^10000.

Also, I changed my code as below-

```
n=True
a,b=map(str, input().split())
for i in range(1,len(min(a,b))+1):
if int(a[-i])+int(b[-i])>=10:
n=False
break
print('Yes' if n==False else 'No')
```

Still didn’t work

The Problem is in line 3,

```
len(min(a,b))
```

I think it should be like this,

```
min(len(a), len(b))
```

It worked. Thank you.

```
num1, num2 = input().split()
num1 = list(map(int, num1))
num2 = list(map(int, num2))
result = []
for i in range(len(num1)):
try:
a = num1[i]
b = num2[i]
except IndexError:
break
else:
if a+b < 10:
result.append(False)
else:
result.append(True)
if any(result):
print("Yes")
else:
print("No"
```

this code failed in test 6

My code gets wrong answer only for test case 7, I’ve done everything but still could not solve it, any and all help is welcome, thank you.

```
a,b = map(str,input().split())
n = min(len(a),len(b))
A = list(a)
A = a[::-1]
B = list(b)
B = b[::-1]
if int(A[0]) + int(B[0]) > 9:
---print("Yes")
---quit()
for i in range(n-1):
---if int(A[i]) + int(B[i]) > 9:
------print("Yes")
------quit()
print("No")
```

Can guys please add C (GCC-4.8.5) which is in CB?

I can’t use most of the string function with the given C.

```
a,b=map(str,input().split())
c=[]
d=[]
for i in range(len(a)):
c.append(int(a[i]))
for i in range(len(b)):
d.append(int(b[i]))
e=c[i]+d[i]
if e>=10:
print('Yes')
break
elif i==len(a)-1 or i==len(b)-1:
print('No')
```

What’s the problem with this code?

Wrong Answer in 7th case. i have also tried considering the carry at the leftmost digit.But it doesnt work

```
#include <stdio.h>
int main() {
int i,count=0,a,b,c,d=0;
scanf("%u%u",&a,&b);
if(a>=b)
{ c=a;
while(c!=0)
{
c=c/10;
count++;
}}
else
{ c=b;
while(c!=0)
{
c=c/10;
count++;
}
}
for(i=1;i<=count;i++)
{
if((a%10 +b%10)>10)
{d++;break;}
a=a/10;b=b/10;
}
if (d==0) printf("No");
else printf("Yes");
return 0;
}
```