I can see my code is working fine for small inputs. But on submission, CodeChef doesn’t accept it. Can anyone help?
Problems : RECIIDCD
//decode optimize
#include <bits/stdc++.h>
using namespace std;
void funct(string str){
for(int i=0 ; i< str.length() ;i++){
if(str[i] >='1' && str[i] <='9'){
for(int j=0; j<str[i]-'0' ; j++)
{
for(int k = i+1 ; ;k++ )
{
if(isalpha(str[k]))
cout<<str[k];
else
break;
}
}
}
}
}
int main()
{
int n;
cin>>n;
bool temp=true;
while(n){
string str;
cin>> str;
if(temp){
for(int i=0;;i++){
if(isalpha(str[i])){
continue;
}else{
temp= false;
break;
}
}
}
funct(str);
n--;
}
return 0;
}