Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Codeforces Round 266B
- #include <string>
- #include <cstring>
- #include <iostream>
- using namespace std;
- int main()
- {
- int n, t;
- string s;
- char mass[51];
- cin >> n >> t;
- cin >> s;
- strcpy(mass, s.c_str());
- for(int i=0;i<t;i++)
- {
- for(int y=0;y<n-1;y++)
- {
- if(mass[y]=='B' && mass[y+1]=='G')
- {
- mass[y]='G';
- mass[y+1]='B';
- y++;
- }
- }
- }
- cout << mass;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement