http://www.spoj.pl/problems/INVESORT/
my code is working fine..but getting wrong please someone help me.. here is my code
include
include
using namespace std;
int main()
{
while(1)
{
char a[10],b[10];
cin>>a>>b;
if(a[0]=='' && b[0]=='')
break;
int count=0,cp,bb=10;
for(int i=0;i<10;i++){
for(int j=1;j if((a[i]==b[j]) && (a[i+1]==b[j-1]))
{
count++;
while(a[i]==b[j])
{ for(int z=j;z<9;z++)
{b[z]=b[z+1];cp=z+1;}
b[cp]='\0';bb--;
i++;j--;}
}
}
}
cout<<count<<endl;
}
}