Advertisement
borsha06

268B_codeforces

Dec 10th, 2017
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5.     int n,i,j,l;
  6.     string s[100];
  7.     cin>>n>>l;
  8.     for(i=0; i<n; i++)
  9.     {
  10.         cin>>s[i];
  11.     }
  12.     while(l)
  13.     {
  14.         for(i=0; i<n; i++)
  15.         {
  16.             if(s[i]=="B" && s[i+1]=="G")
  17.             {
  18.                 std::swap(s[i],s[i+1]);
  19.             }
  20.         }
  21.         l--;
  22.     }
  23.     for(i=0; i<n; i++)
  24.     {
  25.          cout<<s[i]<<endl;
  26.     }
  27.  
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement