#include <stdio.h>
#include <stdlib.h>
int main() {
int a, b;
scanf("%d %d", &a, &b);
char* str=malloc(sizeof(char)*a+1);
scanf("%s",str);
int x,y,i;
char m,n;
while(~scanf("%d %d %c %c",&x,&y,&m,&n))
{
for(i=x-1;i<y;i++)
{
if(*(str+i)==m)
*(str+i)=n;
}
}
printf("%s\n",str);
free(str);
return 0;
}

京公网安备 11010502036488号