#include<iostream> #include<string> using namespace std; int main() { string a; while(cin>>a&&a!="END") { int b; cin>>b; cin.get(); for(int i=0;i<b;i++) { string c; cin>>c; cout<<i+1<<" "; if(a.length()==c.length()) { for(int j=0;j<a.length();j++) { if(a[j]!=c[j]) { cout<<j+1<<" "<<"change "<<a[j]<<endl; break; } else { if(j==a.length()-1) cout<<"OK!"<<endl; } } } else { if(a.length()>c.length()) { for(int j=0;j<a.length();j++) { if(a[j]!=c[j]) { cout<<j+1<<" "<<"insert "<<a[j]<<endl; break; } } } else { for(int j=0;j<c.length();j++) { if(a[j]!=c[j]) { if(c[j]==c[j-1]) { cout<<j<<" "<<"delete "<<c[j]<<endl; break; } else { cout<<j+1<<" "<<"delete "<<c[j]<<endl; break; } } } } } } } return 0; } |
Double click to view unformatted code.