Advertisement
rengetsu

Codeforces_266B

Jul 24th, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. //Codeforces Round 266B
  2. #include <string>
  3. #include <cstring>
  4. #include <iostream>
  5. using namespace std;
  6. int main()
  7. {
  8.     int n, t;
  9.     string s;
  10.     char mass[51];
  11.     cin >> n >> t;
  12.     cin >> s;
  13.     strcpy(mass, s.c_str());
  14.     for(int i=0;i<t;i++)
  15.     {
  16.         for(int y=0;y<n-1;y++)
  17.         {
  18.             if(mass[y]=='B' && mass[y+1]=='G')
  19.             {
  20.                 mass[y]='G';
  21.                 mass[y+1]='B';
  22.                 y++;
  23.             }
  24.         }
  25.     }
  26.     cout << mass;
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement