codeforces 897A Scarborough Fair
题目链接:
http://codeforces.com/problemset/problem/897/A
思路:
暴力大法好
代码:
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
typedef long long ll;
int n,m;
string s;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin>>n>>m;
cin>>s;
int l,r;
char c1,c2;
for(int i=0;i<m;++i) {
cin>>l>>r>>c1>>c2;
for(int j=l-1;j<=r-1;++j) {
if(s[j]==c1) s[j]=c2;
}
}
cout<<s<<endl;
return 0;
}