#include <cstdlib>
#include <iostream>
#include <cstdio>
#include<string>
using namespace std;
string s,sa,sb,chb;
void LCS( string x, string y ) {
int m,n,small,large;
m = x.size();
n = y.size();
if ( m < n ) {
small = m;
large = n;
}
else {
small = n;
large = m;
}
int c[small+1][large+1];
for ( int i = 1; i <= small; i++ ) c[i][0] = 0;
for ( int i = 0; i <= large; i++ ) c[0][i] = 0;
int i = 1;
while( i <= small ) {
if( x[i-1] == y[i-1] ) c[i][i] = c[i-1][i-1] + 1;
else if( x[i-1] != y[i-1] ) break;
i++;
}
printf("%d\n",i-1);
}
int main()
{
int t,q,i,j;
char cha;
scanf("%d\n",&t);
while ( t-- ) {
getline(cin,s);
scanf("%d\n",&q);
while ( q-- ) {
cin >> cha;
if ( cha == 'Q' ){
scanf("%d %d",&i,&j);
sa = s.substr(i-1,s.size()-(i-1));
sb = s.substr(j-1,s.size()-(j-1));
LCS(sa,sb);
}
else if ( cha == 'R' ) {
scanf("%d",&i);
cin >> chb;
s.replace(i-1,1,chb);
}
else if(cha == 'I')
{
scanf("%d",&i);
cin >> chb;
s.insert(i-1,chb);
}
}
}
return 0;
}
This code is again Runtime error ....................Plz help