description: As their story unravels, a timeless tale is told once again...
  
  Shirahime, a friend of Mocha's, is keen on playing the music game Arcaea and sharing Mocha interesting puzzles to solve. This day, Shirahime comes up with a new simple puzzle and wants Mocha to solve them. However, these puzzles are too easy for Mocha to solve, so she wants you to solve them and tell her the answers. The puzzles are described as follow.
  
  There are n squares arranged in a row, and each of them can be painted either red or blue.
  
  Among these squares, some of them have been painted already, and the others are blank. You can decide which color to paint on each blank square.
  
  Some pairs of adjacent squares may have the same color, which is imperfect. We define the imperfectness as the number of pairs of adjacent squares that share the same color.
  
  For example, the imperfectness of "BRRRBBR" is 3, with "BB" occurred once and "RR" occurred twice.
  
  Your goal is to minimize the imperfectness and print out the colors of the squares after painting. 
  
  Input
  
  Each test contains multiple test cases. 
  
  The first line contains a single integer t (1 ≤ t ≤ 100) — the number of test cases. Each test case consists of two lines.
  
  The first line of each test case contains an integer n (1≤ n≤ 100) — the length of the squares row.
  
  The second line of each test case contains a string s with length n, containing characters 'B', 'R' and '?'. Here 'B' stands for a blue square, 'R' for a red square, and '?' for a blank square.
  
  Output
  
  For each test case, print a line with a string only containing 'B' and 'R', the colors of the squares after painting, which imperfectness is minimized. If there are multiple solutions, print any of them.
  
  Example
  
  Input
  
  
  5
  7
  ?R???BR
  7
  ???R???
  1
  ?
  1
  B
  10
  ?R??RB??B?
  
  
  Output
  
  
  BRRBRBR
  BRBRBRB
  B
  B
  BRRBRBBRBR
  
  Note
  
  In the first test case, if the squares are painted "BRRBRBR", the imperfectness is 1 (since squares 2 and 3 have the same color), which is the minimum possible imperfectness.
solution: import java.util.*;
  import java.io.*;
  
  public class MochaRandB {
      PrintWriter out;
      StringTokenizer st;
      BufferedReader br;
      final int imax = Integer.MAX_VALUE, imin = Integer.MIN_VALUE;
      final int mod = 1000000007;
  
      void solve() throws Exception {
          int t = 1;
          t = ni();
          for (int ii = 0; ii < t; ii++) {
              int n= ni();
              char[] arr= ns().toCharArray();
              char[] arr2= new char[arr.length]; for(int i=0;i<n;i++) arr2[i]= arr[i];
  
              int cand1= 0, cand2= 0;
              helper(arr, 'R');
              for(int i=1;i<arr.length;i++) if(arr[i-1]==  arr[i]) cand1++;
              helper(arr2, 'B');
              for(int i=1;i<arr2.length;i++) if(arr2[i-1]==  arr2[i]) cand2++;
  
              if(cand1< cand2) out.println(new String(arr));
              else out.println(new String(arr2));
          }
      }
  
      private void helper(char[] arr, char c) {
          int ans= 0;
          char[] color= new char[26]; color['B'-'A']= 'R'; color['R'-'A']= 'B';
          for(int i=0;i<arr.length;i++) {
              if(arr[i]=='?') arr[i]= c;
              c= color[arr[i]-'A'];
          }
      }
  
      public static void main(String[] args) throws Exception {
          new MochaRandB().run();
      }
  
      void run() throws Exception {
          if (System.getProperty("ONLINE_JUDGE") == null) {
              File file = new File("./input.txt");
              br = new BufferedReader(new FileReader(file));
              out = new PrintWriter("./output.txt");
          } else {
              out = new PrintWriter(System.out);
              br = new BufferedReader(new InputStreamReader(System.in));
          }
  
          long ss = System.currentTimeMillis();
          st = new StringTokenizer("");
          while (true) {
              solve();
              String s = br.readLine();
              if (s == null) break;
              else st = new StringTokenizer(s);
          }
          //out.println(System.currentTimeMillis()-ss+"ms");
          out.flush();
      }
  
      void read() throws Exception {
          st = new StringTokenizer(br.readLine());
      }
  
      int ni() throws Exception {
          if (!st.hasMoreTokens()) read();
          return Integer.parseInt(st.nextToken());
      }
  
      char nc() throws Exception {
          if (!st.hasMoreTokens()) read();
          return st.nextToken().charAt(0);
      }
  
      String nw() throws Exception {
          if (!st.hasMoreTokens()) read();
          return st.nextToken();
      }
  
      long nl() throws Exception {
          if (!st.hasMoreTokens()) read();
          return Long.parseLong(st.nextToken());
      }
  
      int[] ni(int n) throws Exception {
          int[] ret = new int[n];
          for (int i = 0; i < n; i++) ret[i] = ni();
          return ret;
      }
  
      long[] nl(int n) throws Exception {
          long[] ret = new long[n];
          for (int i = 0; i < n; i++) ret[i] = nl();
          return ret;
      }
  
      double nd() throws Exception {
          if (!st.hasMoreTokens()) read();
          return Double.parseDouble(st.nextToken());
      }
  
      String ns() throws Exception {
          String s = br.readLine();
          return s.length() == 0 ? br.readLine() : s;
      }
  
      void print(int[] arr) {
          for (int i : arr) out.print(i + " ");
          out.println();
      }
  
      void print(long[] arr) {
          for (long i : arr) out.print(i + " ");
          out.println();
      }
  
      void print(int[][] arr) {
          for (int[] i : arr) {
              for (int j : i) out.print(j + " ");
              out.println();
          }
      }
  
      void print(long[][] arr) {
          for (long[] i : arr) {
              for (long j : i) out.print(j + " ");
              out.println();
          }
      }
  
      long add(long a, long b) {
          if (a + b >= mod) return (a + b) - mod;
          else return a + b >= 0 ? a + b : a + b + mod;
      }
  
      long mul(long a, long b) {
          return (a * b) % mod;
      }
  
      void print(boolean b) {
          if (b) out.println("YES");
          else out.println("NO");
      }
  
      long binExp(long base, long power) {
          long res = 1l;
          while (power != 0) {
              if ((power & 1) == 1) res = mul(res, base);
              base = mul(base, base);
              power >>= 1;
          }
          return res;
      }
  
      long gcd(long a, long b) {
          if (b == 0) return a;
          else return gcd(b, a % b);
      }
  
      // strictly smaller on left
      void stack_l(int[] arr, int[] left) {
          Stack<Integer> stack = new Stack<>();
          for (int i = 0; i < arr.length; i++) {
              while (!stack.isEmpty() && arr[stack.peek()] >= arr[i]) stack.pop();
              if (stack.isEmpty()) left[i] = -1;
              else left[i] = stack.peek();
              stack.push(i);
          }
      }
  
      // strictly smaller on right
      void stack_r(int[] arr, int[] right) {
          Stack<Integer> stack = new Stack<>();
          for (int i = arr.length - 1; i >= 0; i--) {
              while (!stack.isEmpty() && arr[stack.peek()] >= arr[i]) stack.pop();
              if (stack.isEmpty()) right[i] = arr.length;
              else right[i] = stack.peek();
              stack.push(i);
          }
      }
  
      private void sort(int[] arr) {
          List<Integer> list = new ArrayList<>();
          for (int i : arr) list.add(i);
          Collections.sort(list);
          for (int i = 0; i < arr.length; i++) arr[i] = list.get(i);
      }
  }