Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Rahul255 authored Mar 9, 2019
1 parent 6326b94 commit 5a3e5d9
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions 266B.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include<iostream>
using namespace std;
int main()
{
int n, t;
string s;
cin >> n >> t >> s;
while (t--)
{
for (int i = 1; i < n; ++i)
{
if (s[i] == 'G' && s[i-1] == 'B')
{
s[i] = 'B';
s[i-1] = 'G';
i++;
}
}
}
cout << s << endl;

}

0 comments on commit 5a3e5d9

Please sign in to comment.