#include<bits/stdc++.h>
using namespace std;
void DELETE(char *TEXT, int DEL)
{
int N=strlen(TEXT);
for(int i=DEL;i<N;i++)
{
TEXT[i-1]=TEXT[i];
}
TEXT[N-1]='\0';
}
void INSERT(char *TEXT, int INS, char ITEM)
{
int N=strlen(TEXT);
for(int i=N;i>=INS-1;i--)
{
TEXT[i]=TEXT[i-1];
}
TEXT[INS-1]=ITEM;
TEXT[N+1]='\0';
}
int main()
{
string s="\n0.DELETION\n1.INSERTION\nchoose any: ";
char TEXT[100],ITEM;
int t,DEL,INS;
scanf("%s",TEXT);
while(cout<<s,cin>>t)
{
if(t)
{
cin>>INS>>ITEM;
INSERT(TEXT,INS,ITEM);
}
else
{
cin>>DEL;
DELETE(TEXT,DEL);
}
cout<<TEXT<<endl;
}
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCgp2b2lkIERFTEVURShjaGFyICpURVhULCBpbnQgREVMKQp7CiAgICBpbnQgTj1zdHJsZW4oVEVYVCk7CiAgICBmb3IoaW50IGk9REVMO2k8TjtpKyspCiAgICB7CiAgICAgICAgVEVYVFtpLTFdPVRFWFRbaV07CiAgICB9CiAgICBURVhUW04tMV09J1wwJzsKfQoKdm9pZCBJTlNFUlQoY2hhciAqVEVYVCwgaW50IElOUywgY2hhciBJVEVNKQp7CiAgICBpbnQgTj1zdHJsZW4oVEVYVCk7CiAgICBmb3IoaW50IGk9TjtpPj1JTlMtMTtpLS0pCiAgICB7CiAgICAgICAgVEVYVFtpXT1URVhUW2ktMV07CiAgICB9CiAgICBURVhUW0lOUy0xXT1JVEVNOwogICAgVEVYVFtOKzFdPSdcMCc7Cn0KCmludCBtYWluKCkKewogICAgc3RyaW5nIHM9IlxuMC5ERUxFVElPTlxuMS5JTlNFUlRJT05cbmNob29zZSBhbnk6ICI7CgogICAgY2hhciBURVhUWzEwMF0sSVRFTTsKICAgIGludCB0LERFTCxJTlM7CiAgICBzY2FuZigiJXMiLFRFWFQpOwogICAgd2hpbGUoY291dDw8cyxjaW4+PnQpCiAgICB7CiAgICAgICAgaWYodCkKICAgICAgICB7CiAgICAgICAgICAgIGNpbj4+SU5TPj5JVEVNOwogICAgICAgICAgICBJTlNFUlQoVEVYVCxJTlMsSVRFTSk7CiAgICAgICAgfQogICAgICAgIGVsc2UKICAgICAgICB7CiAgICAgICAgICAgIGNpbj4+REVMOwogICAgICAgICAgICBERUxFVEUoVEVYVCxERUwpOwogICAgICAgIH0KICAgICAgICBjb3V0PDxURVhUPDxlbmRsOwogICAgfQogICAgcmV0dXJuIDA7Cn0K