题目出处:http://codeforces.com/problemset/problem/897/A
题目大意:将某个范围内的某个字符换成另外一个字符
#include<iostream> using namespace std; int main(){ int n,m; cin>>n>>m; string s; cin>>s; while(m--){ int l,r; char in,out; cin>>l>>r>>in>>out; for(int i=l-1;i<r;i++) if(s[i]==in) s[i] = out; } cout<<s; return 0; }
时间: 2024-09-28 16:33:02