Skip to content

Instantly share code, notes, and snippets.

@Jack-Saleem
Created July 17, 2016 13:44
Show Gist options
  • Save Jack-Saleem/3e08bc1166be372caae02bd20d7d1e8e to your computer and use it in GitHub Desktop.
Save Jack-Saleem/3e08bc1166be372caae02bd20d7d1e8e to your computer and use it in GitHub Desktop.
codeforces 266B QueueattheSchool program in java
import java.util.Scanner;
public class QueueattheSchool
{
public static void main(String[] args)
{
Scanner z=new Scanner(System.in);
int n=z.nextInt();
int t=z.nextInt();
String s=z.next();
for(int i=1;i<=t;i++)
{
if(s.contains("BG"))
s=s.replaceAll("BG", "GB");
}
System.out.println(s);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment