i hav tried this code for many test cases in forum and were giving right answers...
plz help me out which test cases is my code failing..
#include<stdio.h>
#include<stdlib.h>
int main()
{
while(1)
{
int i=0,num1=-1,num2;
long long int a=0,b=1,c;
char str[5001];
scanf("%s",str);
if(str[0]=='0')
exit(0);
while(str[i]!='\0')
{
if(str[i+1]!='0')
num2=str[i]-'0';
else
num2=(str[i]-'0')*10;
if(num2>20)
{
c=0;
break;
}
if(num2!=0 && num1!=0)
{
if(num1==-1 && num2<=26 || num1!=-1 && num1*10+num2<=26)
{
c=a+b;
a=b;
b=c;
// printf("\na=%lld b=%lldc=%lld",a,b,c);
}
else
a=b;
}
else
a=b;
num1=num2;
i++;
}
printf("%lld\n",c);
}
return 0;
}