Skip to content

Commit b0227a8

Browse files
committed
Added 266B - Queue at the School.cpp
1 parent 4d000d5 commit b0227a8

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

266B - Queue at the School.cpp

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// ॐ नमः शिवाय
2+
#include<bits/stdc++.h>
3+
using namespace std;
4+
#define pb push_back
5+
6+
// Code Written By: Vikash Patel
7+
// Codeforces Profile: https://codeforces.com/profile/vikashpatel
8+
9+
int main()
10+
{
11+
int n, t;
12+
string s;
13+
cin >> n >> t >> s;
14+
while (t--)
15+
{
16+
for (int i = 1; i < n; ++i)
17+
{
18+
if (s[i] == 'G' && s[i-1] == 'B')
19+
{
20+
s[i] = 'B';
21+
s[i-1] = 'G';
22+
++i;
23+
}
24+
}
25+
}
26+
cout << s << endl;
27+
return 0;
28+
}

0 commit comments

Comments
 (0)