using System;
using System.Linq;

namespace ConsoleApplication6
{
    class Program
    {
        static void Main(string[] args)
        {
            var numbers = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var changesToPerform = numbers[1];
            var queue = Console.ReadLine().ToCharArray().Select(x => x == 'G' ? 1 : 0).ToArray();

            for (int i = 1; i <= changesToPerform; i++)
            {
                for (int j = 0; j < queue.Length - 1; j++)
                {
                    if (queue[j] == 0 && queue[j + 1] == 1)
                    {
                        queue[j] = 1;
                        queue[j + 1] = 0;
                        j ++;
                    }
                }
            }

            Console.WriteLine(string.Join(string.Empty,queue.Select(x => x == 0 ? "B" : "G")));
        }
    }
}

using System;
using System.Collections;
using System.Linq;

namespace TmpApp
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int n = Convert.ToInt32(input[0]);
            int t = Convert.ToInt32(input[1]);
            string queueString = Console.ReadLine();
            char[] queue = queueString.ToCharArray();
            for (int i = 0; i < t; ++i)
            {
                bool flag = false;
                for (int j = 0; j < n - 1; ++j)
                {
                    if (flag)
                    {
                        flag = false;
                        continue;
                    }
                    if (queue[j] == 'B' && queue[j + 1] == 'G' && !flag)
                    {
                        queue[j] = 'G';
                        queue[j + 1] = 'B';
                        flag = true;
                    }
                }
            }
            Console.WriteLine(queue);
        }
    }
}

using System;
    using System.Collections.Generic;
    using System.Globalization;
    using System.Linq;
    using System.Text;

    public class Program
    {
        public static void Main(string[] args)
        {
            var arr = Console.ReadLine().Split();
            var n = int.Parse(arr[0]);
            var t = int.Parse(arr[1]);
            var str = Console.ReadLine();
            var sb = new StringBuilder(str);
            var temp = ' ';

            while (t >= 1)
            {
                for (int i = 0; i < n - 1; i++)
                {
                    if (sb[i] == 'B' && sb[i + 1] == 'G')
                    {
                        temp = sb[i];
                        sb[i] = sb[i + 1];
                        sb[i + 1] = temp;
                        i++;
                    }
                }

                t--;
            }
            for (int i = 0; i < n; i++)
            {
                Console.Write(sb[i]);
            }
            }
    }

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Codeforces266B_Queue_at_the_School
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] num = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int n = num[0];
            int t = num[1];
            string str = Console.ReadLine();
            char[] ch = str.ToCharArray();
            //char[] output = new char[n];

            for (int i=0;i< t;i++)
            {
                for(int j=0;j< n-1;j++)
                {
                    if (ch[j] == 'B' && ch[j + 1] == 'G')
                    {
                        ch[j] = 'G';
                        ch[j + 1] = 'B';
                        j++;
                    }

                }

            }
            Console.WriteLine(ch);

        }
    }
}

using System;
using System.Linq;
using System.Collections.Generic;
using System.Globalization;

public class Program
{
	public static void Main()
	{
		var a=Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
		string s=Console.ReadLine();

		for(int i=0; i<a[1]; i++)
		{
			s=s.Replace("BG","GB");
		}

		Console.WriteLine(s);
	}

}

using System;
using System.Collections.Generic;

namespace MTests
{
    class Program
    {

        internal static void MyMain() {
            int n;
            int t;
            RInts(out n,out t);
            string line = RLine();

            for (int c = 0; c < t; c++) {

                List<int> indexes = new List<int>();

                for (int i = 0; i < n-1; i++) {
                    if (line[i] == 'B' && line[i + 1] == 'G') {
                        indexes.Add(i);
                    }
                }

                for (int i = 0; i < indexes.Count; i++)
                {
                    line = line.Remove(indexes[i], 2).Insert(indexes[i],"GB");
                }

            }
            WLine(line);

        }

        static void Main(string[] args)
        {

#if !HOME
            MyMain();
#else
            Secret.MyMain();
#endif
        }

        #region Utils
        static string RLine()
        {
            return Console.ReadLine();
        }

        static string[] RLine(string separator)
        {
            return Console.ReadLine().Split(new string[] { separator }, StringSplitOptions.None);
        }

        static int RInt()
        {
            var str = Console.ReadLine();
            return Convert.ToInt32(str);
        }
        static int[] RInts()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), s => Convert.ToInt32(s));
        }
        static void RInts(out int a, out int b)
        {
            var ints = RInts();
            a = ints[0];
            b = ints[1];
        }

        public static void WLine<T>(T s)
        {
            Console.WriteLine(s);
        }
        #endregion

    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Runtime.InteropServices;

namespace ConsoleApplication1
{
    //internal class Exams : IComparable<Exams>
    //{
    //    public int s, r;

    //    public Exams(int a, int b)
    //    {
    //        s = a;

    //        r = b;
    //    }

    //    int IComparable<Exams>.CompareTo(Exams other)
    //    {
    //        return this.r.CompareTo(other.r);
    //    }
    //}

    internal class Program
    {
        //private static string s = "";

        private static void Main(string[] args)
        {
            //var t = Console.ReadLine().Split(' ');

            //int theNumberOfExams = int.Parse(t[0]),
            //    theMaxScore = int.Parse(t[1]),
            //    theAverageScore = int.Parse(t[2]);

            //long theSumOfScores = 0,
            //    answer = 0,
            //    k;

            //Exams[] scores = new Exams[theNumberOfExams];

            //for (int i = 0; i < theNumberOfExams; i++)
            //{
            //    t = Console.ReadLine().Split(' ');

            //    scores[i] = new Exams(int.Parse(t[0]), int.Parse(t[1]));

            //    theSumOfScores += scores[i].s;
            //}

            //if (theSumOfScores/theNumberOfExams >= theAverageScore)
            //{
            //    Console.WriteLine(0);
            //}
            //else
            //{
            //    Array.Sort(scores);

            //    for (int i = 0; i < theSumOfScores; i++)
            //    {
            //        if (scores[i].s < theMaxScore)
            //        {
            //            k = Math.Min(theAverageScore*theNumberOfExams - theSumOfScores,
            //                theMaxScore - scores[i].s);

            //            theSumOfScores += Math.Min(theAverageScore*theNumberOfExams - theSumOfScores,
            //                theMaxScore - scores[i].s);

            //            answer += scores[i].r*k;

            //            if (theSumOfScores / theNumberOfExams >= theAverageScore)
            //            {
            //                break;
            //            }
            //        }
            //    }

            //    Console.WriteLine(answer);
            //}

            var x = Console.ReadLine().Split(' ');

            Int16 n = Int16.Parse(x[0]),
                t = Int16.Parse(x[1]),
                k = 0;

            StringBuilder s = new StringBuilder(Console.ReadLine());

            while (k != t)
            {
                for (int i = 0; i < s.Length-1; i++)
                {
                    if (s[i] == 'B' && s[i + 1] == 'G')
                    {
                        s[i] = 'G';
                        s[i + 1] = 'B';

                        i++;
                    }
                }

                k++;
            }

            Console.WriteLine(s);
        }
    }
}

using System;

namespace ContestsConsoleLab
{
    class Program
    {
        static void Main(string[] args)
        {
            int chNum = 0, secNum = 0;
            string queue;
            var numssArr =Console.ReadLine();

            chNum =int.Parse(numssArr.Split(' ')[0]);
            secNum=int.Parse(numssArr.Split(' ')[1]);

            queue = Console.ReadLine();
            var quArr=queue.ToCharArray();
            for (int i = 0; i < secNum; i++)
            {
                for (int j = 0; j < chNum-1; j++)
                {
                    if (quArr[j] == 'B' && quArr[j + 1] == 'G')
                    {
                        quArr[j] = 'G';
                        quArr[j + 1] = 'B';
                        j++;
                    }
                }
            }
            Console.WriteLine(quArr);
        }
    }
}

#define ASD
#if (Debug)
#define Trace
#endif
#if (ASD)
using DS.Common;
using DS.Dictionaries;
using DS.Graphs;
using DS.Heaps;
using DS.Lists;
using DS.Trees;
using DS;
using AL;
using AL.Common;
using AL.Graphs;
using AL.Numeric;
using AL.Sorting;
#endif
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using GenericArithmetic;
using System.Reflection;
using System.Windows;
using System.Text.RegularExpressions;
using csConsoleforStudy;
using System.Resources;
using System.Runtime.Serialization;

namespace csConsoleforStudy
{
 class Program
 {
  const double MemoryLimit = 2.56;
  const double TimeLimit = 4000;
  static Stream fsr;
  static FileStream fsw;
  static TextReader tr;
  static TextWriter tw;
  static Thread t;
  static Thread mainThread = Thread.CurrentThread;
  static Stopwatch sw = new Stopwatch();
  static DefaultTraceListener Logger;
  static long maxUsedMemory = 0;
  static void Main(string[] args)
  {
   OpenStream();
   Solver s = new Solver();
   s.Solve();
   CloseStream();
  }

  static void OpenStream()
  {
#if (Debug)
#endif
  }

  static void CloseStream()
  {
#if (Debug)
#endif
  }

  static void CheckMemory()
  {
#if (Debug)
#endif
  }
 }

 class Solver
 {
  public void Solve()
  {
   var l1 = ria();
   var n = l1[0];
   var t = l1[1];
   var l2 = Console.ReadLine();
   char[] State = l2.ToCharArray();
   List<int> pos = new List<int>();
   for (int i = 0; i < State.Length; i++)
   {
    if (State[i] == 'B')
     pos.Add(i);
   }

   for (int round = 0; round < t; round++)
   {
    for (int i = 0; i < pos.Count; i++)
    {
     if (i == pos.Count - 1)
     {
      pos[i] += 1;
     }
     else if (pos[i] < State.Length && pos[i + 1] != pos[i] + 1)
     {
      pos[i] += 1;
     }

     if (pos[i] == State.Length)
      pos[i] -= 1;
    }
   }

   StringBuilder sb = new StringBuilder(State.Length);
   for (int i = 0; i < State.Length; i++)
   {
    if (pos.Contains(i))
    {
     sb.Append('B');
    }
    else
    {
     sb.Append('G');
    }
   }

   Console.WriteLine(sb.ToString());
  }

  public char[] swap(char[] str, int a, int b)
  {
   Tuple<char, char> chars = new Tuple<char, char>(str[a], str[b]);
   str[a] = chars.Item2;
   str[b] = chars.Item1;
   return str;
  }

#region SolverUtils
  private const double AbsoluteError = 1e-10;
  private const double RelativeError = 1e-8;
  private static int NextInt()
  {
   int c;
   int res = 0;
   do
   {
    c = Console.Read();
    if (c == -1)
     return res;
   }
   while (c < '0' || c > '9');
   res = c - '0';
   while (true)
   {
    c = Console.Read();
    if (c < '0' || c > '9')
     return res;
    res *= 10;
    res += c - '0';
   }
  }

  static string rs()
  {
   return Console.ReadLine();
  }

  static int ri()
  {
   return int.Parse(Console.ReadLine());
  }

  static long rl()
  {
   return long.Parse(Console.ReadLine());
  }

  static double rd()
  {
   return double.Parse(Console.ReadLine());
  }

  static string[] rsa()
  {
   return Console.ReadLine().Split(' ');
  }

  static int[] ria()
  {
   return Array.ConvertAll(Console.ReadLine().Split(' '), e => int.Parse(e));
  }

  static long[] rla()
  {
   return Array.ConvertAll(Console.ReadLine().Split(' '), e => long.Parse(e));
  }

  static double[] rda()
  {
   return Array.ConvertAll(Console.ReadLine().Split(' '), e => double.Parse(e));
  }

  static void ReadLineAndAssign(string type, params object[] p)
  {
   dynamic input;
   if (type.StartsWith("i"))
    input = ria();
   else if (type.StartsWith("l"))
    input = rla();
   else if (type.StartsWith("d"))
    input = rda();
   else
    throw new AE("no match " + type.ToString());
   for (int i = 0; i < p.Length; i++)
   {
    p[i] = input[i];
   }
  }

  static void SwapIfGreater<T>(ref T lhs, ref T rhs)where T : IComparable<T>
  {
   T temp;
   if (lhs.CompareTo(rhs) > 0)
   {
    temp = lhs;
    lhs = rhs;
    rhs = temp;
   }
  }

  static bool DoubleEqual(double a, double b)
  {
   double diff = Math.Abs(a - b);
   if (diff < AbsoluteError)
    return true;
   return diff <= RelativeError * Math.Max(Math.Abs(a), Math.Abs(b));
  }

  static dynamic abs(dynamic num)
  {
   return Math.Abs(num);
  }

  static dynamic max(dynamic a, dynamic b)
  {
   return Math.Max(a, b);
  }
 }

 static class MyExtensions
 {
  public static string Reverse(this string str)
  {
   StringBuilder sb = new StringBuilder(str.Length);
   for (int i = str.Length - 1; i >= 0; i--)
   {
    sb.Append(str[i]);
   }

   return sb.ToString();
  }
 }

#endregion
 struct Pair
 {
  public long X, Y;
  public Pair(long x, long y)
  {
   X = x;
   Y = y;
  }
 }

 struct Bit
 {
  bool state;
  public Bit(bool state)
  {
   this.state = state;
  }

  public override int GetHashCode()
  {
   return base.GetHashCode();
  }

  public override string ToString()
  {
   return state.ToString();
  }

  public override bool Equals(object other)
  {
   if (other is Bit)
   {
    return state == ((Bit)other).state;
   }
   else
   {
    if ((int)other == 1 && state == true)
     return true;
    else if ((int)other == 0 && state == false)
     return true;
    else
     return base.Equals(other);
   }
  }

  public static implicit operator bool (Bit a)
  {
   return a.state;
  }

  public static implicit operator Bit(bool a)
  {
   return new Bit(a);
  }

  public static implicit operator Bit(int a)
  {
   if (a == 0)
    return new Bit(false);
   return new Bit(true);
  }

  public static bool operator ==(Bit a, Bit b)
  {
   return a.state == b.state;
  }

  public static bool operator !=(Bit a, Bit b)
  {
   return a.state != b.state;
  }

  public static Bit operator !(Bit a)
  {
   return new Bit(!a.state);
  }

  public static Bit operator +(Bit a, Bit b)
  {
   return new Bit(a.state || b.state);
  }

  public static Bit operator *(Bit a, Bit b)
  {
   return new Bit(a.state && b.state);
  }

  public static Bit operator ^(Bit a, Bit b)
  {
   return new Bit(a.state ^ b.state);
  }
 }

#if (MS)
#endif
#region Exceptions
 [Serializable]
 internal class IOE : InvalidOperationException
 {
  public IOE()
  {
  }

  public IOE(string message): base (message)
  {
  }

  public IOE(string message, Exception innerException): base (message, innerException)
  {
  }

  protected IOE(SerializationInfo info, StreamingContext context): base (info, context)
  {
  }
 }

 [Serializable]
 internal class AE : ArgumentException
 {
  public AE()
  {
  }

  public AE(string message): base (message)
  {
  }

  public AE(string message, Exception innerException): base (message, innerException)
  {
  }

  protected AE(SerializationInfo info, StreamingContext context): base (info, context)
  {
  }
 }
#endregion
}

namespace GenericArithmetic
{
 public class Vector<T>
 {
  public static readonly ICalculator<T> Calculator = Number<T>.Calculator;
  public T X
  {
   get;
   set;
  }

  public T Y
  {
   get;
   set;
  }

  public Vector(T x, T y)
  {
   X = x;
   Y = y;
  }

  public override bool Equals(object obj)
  {
   return base.Equals(obj);
  }

  public override int GetHashCode()
  {
   return base.GetHashCode();
  }

  public static bool operator ==(Vector<T> a, Vector<T> b)
  {
   return EqualityComparer<T>.Default.Equals(a.X, b.X) && EqualityComparer<T>.Default.Equals(a.Y, b.Y);
  }

  public static bool operator !=(Vector<T> a, Vector<T> b)
  {
   return !(EqualityComparer<T>.Default.Equals(a.X, b.X) && EqualityComparer<T>.Default.Equals(a.Y, b.Y));
  }

  public static Vector<T> operator !(Vector<T> a)
  {
   return new Vector<T>(Calculator.Difference(new Number<T>(default (T)), a.X), Calculator.Difference(new Number<T>(default (T)), a.Y));
  }

  public static Vector<T> operator +(Vector<T> a, Vector<T> b)
  {
   return new Vector<T>(Calculator.Sum(a.X, b.X), Calculator.Sum(a.Y, b.Y));
  }

  public static Vector<T> operator -(Vector<T> a, Vector<T> b)
  {
   return new Vector<T>(Calculator.Difference(a.X, b.X), Calculator.Difference(a.Y, b.Y));
  }
 }

 public class Matrix<T>
 {
  public static readonly ICalculator<T> Calculator = Number<T>.Calculator;
  public int W
  {
   get;
   set;
  }

  public int H
  {
   get;
   set;
  }

  public int rows
  {
   get
   {
    return H;
   }

   set
   {
    H = value;
   }
  }

  public int cols
  {
   get
   {
    return W;
   }

   set
   {
    W = value;
   }
  }

  public T[, ] Map
  {
   get;
   set;
  }

  public T this[int x, int y]
  {
   get
   {
    return Map[x, y];
   }

   set
   {
    Map[x, y] = value;
   }
  }

  public Matrix(T[, ] map)
  {
   Map = map;
   W = map.GetLength(0);
   H = map.GetLength(1);
  }

  public Matrix(int w, int h, T defaultValue = default (T))
  {
   W = w;
   H = h;
   Map = new T[W, H];
#if (ASD)
   Map.Populate(W, H, defaultValue);
#endif
  }

  public override bool Equals(object obj)
  {
   if (obj is Matrix<T>)
   {
    return this == (Matrix<T>)obj;
   }

   return base.Equals(obj);
  }

  public override int GetHashCode()
  {
   return base.GetHashCode();
  }

  public static bool operator ==(Matrix<T> a, Matrix<T> b)
  {
   bool ret = true;
   if (a.Map != b.Map)
    ret = false;
   else if (a.W != b.W)
    ret = false;
   else if (a.H != b.H)
    ret = false;
   return ret;
  }

  public static bool operator !=(Matrix<T> a, Matrix<T> b)
  {
   bool ret = true;
   if (a.Map != b.Map)
    ret = false;
   else if (a.W != b.W)
    ret = false;
   else if (a.H != b.H)
    ret = false;
   return !ret;
  }

  public static Matrix<T> operator +(Matrix<T> a, Matrix<T> b)
  {
   if (a.W != b.W)
    return null;
   else if (a.H != b.H)
    return null;
   else
   {
    Matrix<T> ret = new Matrix<T>(a.W, a.H);
    for (int i = 0; i < a.W; i++)
    {
     for (int j = 0; j < a.H; j++)
     {
      ret[i, j] = Calculator.Sum(a[i, j], b[i, j]);
     }
    }

    return ret;
   }
  }

  public static Matrix<T> operator -(Matrix<T> a, Matrix<T> b)
  {
   if (a.W != b.W)
    return null;
   else if (a.H != b.H)
    return null;
   else
   {
    Matrix<T> ret = new Matrix<T>(a.W, a.H);
    for (int i = 0; i < a.W; i++)
    {
     for (int j = 0; j < a.H; j++)
     {
      ret[i, j] = Calculator.Difference(a[i, j], b[i, j]);
     }
    }

    return ret;
   }
  }

  public static Matrix<T> operator *(Matrix<T> a, Matrix<T> b)
  {
   if (a.cols != b.rows)
    throw new FormatException("Cannot multiply : a.W = " + a.W.ToString() + " with b.H = " + b.H.ToString());
   else
   {
    Matrix<T> R = new Matrix<T>(a.rows, b.cols);
    for (int i = 0; i < R.rows; i++)
     for (int j = 0; j < R.cols; j++)
      for (int k = 0; k < a.cols; k++)
      {
       R[i, j] = Calculator.Sum(R[i, j], Calculator.Multiply(a[i, k], b[k, j]));
      }

    return R;
   }
  }
 }

 public static class Calculator
 {
  public static T Sum<T>(T a, T b)
  {
   return Number<T>.Sum(a, b);
  }
 }

 public interface ICalculator<T>
 {
  T Sum(T a, T b);
  T Difference(T a, T b);
  int Compare(T a, T b);
  T Multiply(T a, T b);
  T Divide(T a, T b);
  T Divide(T a, int b);
 }

 struct Int32Calculator : ICalculator<Int32>
 {
  public Int32 Sum(Int32 a, Int32 b)
  {
   return a + b;
  }

  public Int32 Difference(Int32 a, Int32 b)
  {
   return a - b;
  }

  public int Compare(Int32 a, Int32 b)
  {
   return Difference(a, b);
  }

  public int Multiply(Int32 a, Int32 b)
  {
   return a * b;
  }

  public int Divide(Int32 a, Int32 b)
  {
   return a / b;
  }
 }

 struct Int64Calculator : ICalculator<Int64>
 {
  public Int64 Sum(Int64 a, Int64 b)
  {
   return a + b;
  }

  public Int64 Difference(Int64 a, Int64 b)
  {
   return a - b;
  }

  public int Compare(Int64 a, Int64 b)
  {
   if (a > b)
   {
    return 1;
   }
   else if (a < b)
   {
    return -1;
   }
   else
   {
    return 0;
   }
  }

  public Int64 Multiply(Int64 a, Int64 b)
  {
   return a * b;
  }

  public Int64 Divide(Int64 a, Int64 b)
  {
   return a / b;
  }

  public Int64 Divide(Int64 a, int b)
  {
   return a / b;
  }
 }

 struct SingleCalculator : ICalculator<Single>
 {
  public Single Sum(Single a, Single b)
  {
   return a + b;
  }

  public Single Difference(Single a, Single b)
  {
   return a - b;
  }

  public int Compare(Single a, Single b)
  {
   if (a > b)
   {
    return 1;
   }
   else if (a < b)
   {
    return -1;
   }
   else
   {
    return 0;
   }
  }

  public Single Multiply(Single a, Single b)
  {
   return a * b;
  }

  public Single Divide(Single a, Single b)
  {
   return a / b;
  }

  public Single Divide(Single a, int b)
  {
   return a / b;
  }
 }

 struct DoubleCalculator : ICalculator<double>
 {
  public double Sum(double a, double b)
  {
   return a + b;
  }

  public double Difference(double a, double b)
  {
   return a - b;
  }

  public int Compare(double a, double b)
  {
   if (a > b)
   {
    return 1;
   }
   else if (a < b)
   {
    return -1;
   }
   else
   {
    return 0;
   }
  }

  public double Multiply(double a, double b)
  {
   return a * b;
  }

  public Double Divide(Double a, Double b)
  {
   return a / b;
  }

  public Double Divide(Double a, int b)
  {
   return a / b;
  }
 }

 struct StringCalculator : ICalculator<string>
 {
  public string Sum(string a, string b)
  {
   return a + b;
  }

  public string Difference(string a, string b)
  {
   if (b.Length < a.Length)
   {
    return a.Substring(0, b.Length);
   }
   else
   {
    return "";
   }
  }

  public int Compare(string a, string b)
  {
   return a.CompareTo(b);
  }

  public string Multiply(string a, string b)
  {
   if (a.Length == 1 && b.Length == 1)
   {
    return ((char)(((byte)a[0] * (byte)b[0]) % 256)) + "";
   }

   int bigLength = Math.Max(a.Length, b.Length);
   while (a.Length < bigLength)
   {
    a = " " + a;
   }

   while (b.Length < bigLength)
   {
    b = " " + b;
   }

   string result = "";
   for (int i = 0; i < bigLength; i++)
   {
    Number<string> numA = a[i] + "";
    Number<string> numB = b[i] + "";
    result += numA * numB;
   }

   return result;
  }

  public String Divide(String a, String b)
  {
   return String.Format("{0} / {1}", a, b);
  }

  public String Divide(String a, int b)
  {
   return String.Format("{0} / {1}", a, b);
  }
 }

 public class Number<T>
 {
  private T value;
  public Number(T value)
  {
   this.value = value;
   Type calculatorType = GetCalculatorType();
   fCalculator = Activator.CreateInstance(calculatorType) as ICalculator<T>;
  }

  public static Type GetCalculatorType()
  {
   Type tType = typeof (T);
   Type calculatorType = null;
   if (tType == typeof (Int32))
   {
    calculatorType = typeof (Int32Calculator);
   }
   else if (tType == typeof (Int64))
   {
    calculatorType = typeof (Int64Calculator);
   }
   else if (tType == typeof (Double))
   {
    calculatorType = typeof (DoubleCalculator);
   }
   else if (tType == typeof (string))
   {
    calculatorType = typeof (StringCalculator);
   }
   else
   {
    throw new InvalidCastException(String.Format("Unsupported Type- Type {0} does not have a partner implementation of interface ICalculator<T> and cannot be used in generic arithmetic using type Number<T>", tType.Name));
   }

   return calculatorType;
  }

  private static ICalculator<T> fCalculator = null;
  public static ICalculator<T> Calculator
  {
   get
   {
    if (fCalculator == null)
    {
     MakeCalculator();
    }

    return fCalculator;
   }
  }

  public static void MakeCalculator()
  {
   Type calculatorType = GetCalculatorType();
   fCalculator = Activator.CreateInstance(calculatorType) as ICalculator<T>;
  }

#region operation methods
  public static T Sum(T a, T b)
  {
   return Calculator.Sum(a, b);
  }

  public static T Difference(T a, T b)
  {
   return Calculator.Difference(a, b);
  }

  public static int Compare(T a, T b)
  {
   return Calculator.Compare(a, b);
  }

  public static T Multiply(T a, T b)
  {
   return Calculator.Multiply(a, b);
  }

  public static T Divide(T a, T b)
  {
   return Calculator.Divide(a, b);
  }

  public static T Divide(T a, int b)
  {
   return Calculator.Divide(a, b);
  }

#endregion
#region Operators
  public static implicit operator Number<T>(T a)
  {
   return new Number<T>(a);
  }

  public static implicit operator T(Number<T> a)
  {
   return a.value;
  }

  public static Number<T> operator +(Number<T> a, Number<T> b)
  {
   return Calculator.Sum(a.value, b.value);
  }

  public static Number<T> operator -(Number<T> a, Number<T> b)
  {
   return Calculator.Difference(a, b);
  }

  public static bool operator>(Number<T> a, Number<T> b)
  {
   return Calculator.Compare(a, b) > 0;
  }

  public static bool operator <(Number<T> a, Number<T> b)
  {
   return Calculator.Compare(a, b) < 0;
  }

  public static Number<T> operator *(Number<T> a, Number<T> b)
  {
   return Calculator.Multiply(a, b);
  }

  public static Number<T> operator /(Number<T> a, Number<T> b)
  {
   return Calculator.Divide(a, b);
  }

  public static Number<T> operator /(Number<T> a, int b)
  {
   return Calculator.Divide(a, b);
  }
#endregion
 }
}

#if (ASD)
#region DataStructures
namespace DS.Common
{
 public static class Comparers
 {
  public static bool IsNumber<T>(this T value)
  {
   if (value is sbyte)
    return true;
   if (value is byte)
    return true;
   if (value is short)
    return true;
   if (value is ushort)
    return true;
   if (value is int)
    return true;
   if (value is uint)
    return true;
   if (value is long)
    return true;
   if (value is ulong)
    return true;
   if (value is float)
    return true;
   if (value is double)
    return true;
   if (value is decimal)
    return true;
   return false;
  }

  public static bool IsEqualTo<T>(this T firstValue, T secondValue)where T : IComparable<T>
  {
   return firstValue.Equals(secondValue);
  }

  public static bool IsGreaterThan<T>(this T firstValue, T secondValue)where T : IComparable<T>
  {
   return firstValue.CompareTo(secondValue) > 0;
  }

  public static bool IsLessThan<T>(this T firstValue, T secondValue)where T : IComparable<T>
  {
   return firstValue.CompareTo(secondValue) < 0;
  }

  public static bool IsGreaterThanOrEqualTo<T>(this T firstValue, T secondValue)where T : IComparable<T>
  {
   return (firstValue.IsEqualTo(secondValue) || firstValue.IsGreaterThan(secondValue));
  }

  public static bool IsLessThanOrEqualTo<T>(this T firstValue, T secondValue)where T : IComparable<T>
  {
   return (firstValue.IsEqualTo(secondValue) || firstValue.IsLessThan(secondValue));
  }
 }

 public static class Helpers
 {
  public static void Swap<T>(this IList<T> list, int firstIndex, int secondIndex)
  {
   if (list.Count < 2 || firstIndex == secondIndex)
    return;
   var temp = list[firstIndex];
   list[firstIndex] = list[secondIndex];
   list[secondIndex] = temp;
  }

  public static string PadCenter(this string text, int newW, char fillerCharacter = ' ')
  {
   if (string.IsNullOrEmpty(text))
    return text;
   int length = text.Length;
   int cTP = newW - length;
   if (cTP < 0)
    throw new AE("New w must be greater than string length.");
   int pL = cTP / 2 + cTP % 2;
   int pR = cTP / 2;
   StringBuilder rB = new StringBuilder(newW);
   for (int i = 0; i < pL; i++)
    rB.Insert(i, fillerCharacter);
   for (int i = 0; i < length; i++)
    rB.Insert(i + pL, text[i]);
   for (int i = newW - pR; i < newW; i++)
    rB.Insert(i, fillerCharacter);
   return rB.ToString();
  }

  public static void Populate<T>(this T[, ] array, int rows, int columns, T defaultValue = default (T))
  {
   for (int i = 0; i < rows; ++i)
   {
    for (int j = 0; j < columns; ++j)
    {
     array[i, j] = defaultValue;
    }
   }
  }
 }
}

namespace DS.Dictionaries
{
}

namespace DS.Graphs
{
}

namespace DS.Hashing
{
}

namespace DS.Heaps
{
 public interface IMaxHeap<T>
  where T : System.IComparable<T>
 {
  int Count
  {
   get;
  }

  bool IsEmpty
  {
   get;
  }

  void Initialize(System.Collections.Generic.IList<T> newCollection);
  void Add(T heapKey);
  T Peek();
  void RemoveMax();
  T ExtractMax();
  void Clear();
  void RebuildHeap();
  T[] ToArray();
  System.Collections.Generic.List<T> ToList();
  IMinHeap<T> ToMinHeap();
 }

 public interface IMinHeap<T>
  where T : System.IComparable<T>
 {
  int Count
  {
   get;
  }

  bool IsEmpty
  {
   get;
  }

  void Initialize(System.Collections.Generic.IList<T> newCollection);
  void Add(T heapKey);
  T Peek();
  void RemoveMin();
  T ExtractMin();
  void Clear();
  void RebuildHeap();
  T[] ToArray();
  System.Collections.Generic.List<T> ToList();
  IMaxHeap<T> ToMaxHeap();
 }
}

namespace DS.Lists
{
 public class ArrayList<T> : IEnumerable<T>
 {
  bool DefaultMaxCapacityIsX64 = true;
  bool IsMaximumCapacityReached = false;
  public const int MAXIMUM_ARRAY_LENGTH_x64 = 2146435071;
  public const int MAXIMUM_ARRAY_LENGTH_x86 = 134217728;
  private readonly T[] _emptyArray = new T[0];
  private const int _defaultCapacity = 8;
  private T[] _collection;
  private int _size
  {
   get;
   set;
  }

  public ArrayList(): this (capacity: 0)
  {
  }

  public ArrayList(int capacity)
  {
   if (capacity < 0)
   {
    throw new ArgumentOutOfRangeException();
   }
   else if (capacity == 0)
   {
    _collection = _emptyArray;
   }
   else
   {
    _collection = new T[capacity];
   }

   _size = 0;
  }

  private void _ensureCapacity(int minCapacity)
  {
   if (_collection.Length < minCapacity && IsMaximumCapacityReached == false)
   {
    int newCapacity = (_collection.Length == 0 ? _defaultCapacity : _collection.Length * 2);
    int maxCapacity = (DefaultMaxCapacityIsX64 == true ? MAXIMUM_ARRAY_LENGTH_x64 : MAXIMUM_ARRAY_LENGTH_x86);
    if (newCapacity < minCapacity)
     newCapacity = minCapacity;
    if (newCapacity >= maxCapacity)
    {
     newCapacity = maxCapacity - 1;
     IsMaximumCapacityReached = true;
    }

    this._resizeCapacity(newCapacity);
   }
  }

  private void _resizeCapacity(int newCapacity)
  {
   if (newCapacity != _collection.Length && newCapacity > _size)
   {
    try
    {
     Array.Resize<T>(ref _collection, newCapacity);
    }
    catch (OutOfMemoryException)
    {
     if (DefaultMaxCapacityIsX64 == true)
     {
      DefaultMaxCapacityIsX64 = false;
      _ensureCapacity(newCapacity);
     }

     throw;
    }
   }
  }

  public int Count
  {
   get
   {
    return _size;
   }
  }

  public int Capacity
  {
   get
   {
    return _collection.Length;
   }
  }

  public bool IsEmpty
  {
   get
   {
    return (Count == 0);
   }
  }

  public T First
  {
   get
   {
    return _collection[0];
   }
  }

  public T Last
  {
   get
   {
    return _collection[Count - 1];
   }
  }

  public T this[int index]
  {
   get
   {
    return _collection[index];
   }

   set
   {
    _collection[index] = value;
   }
  }

  public void Add(T dataItem)
  {
   if (_size == _collection.Length)
   {
    _ensureCapacity(_size + 1);
   }

   _collection[_size++] = dataItem;
  }

  public void AddRange(IEnumerable<T> elements)
  {
   if (elements == null)
    throw new ArgumentNullException();
   if (((uint)_size + elements.Count()) > MAXIMUM_ARRAY_LENGTH_x64)
    throw new OverflowException();
   if (elements.Any())
   {
    _ensureCapacity(_size + elements.Count());
    foreach (var element in elements)
     this.Add(element);
   }
  }

  public void AddRepeatedly(T value, int count)
  {
   if (count < 0)
    throw new ArgumentOutOfRangeException();
   if (((uint)_size + count) > MAXIMUM_ARRAY_LENGTH_x64)
    throw new OverflowException();
   if (count > 0)
   {
    _ensureCapacity(_size + count);
    for (int i = 0; i < count; i++)
     this.Add(value);
   }
  }

  public void InsertAt(T dataItem, int index)
  {
   if (_size == _collection.Length)
   {
    _ensureCapacity(_size + 1);
   }

   if (index < _size)
   {
    Array.Copy(_collection, index, _collection, index + 1, (_size - index));
   }

   _collection[index] = dataItem;
   _size++;
  }

  public bool Remove(T dataItem)
  {
   int index = IndexOf(dataItem);
   if (index >= 0)
   {
    RemoveAt(index);
    return true;
   }

   return false;
  }

  public void RemoveAt(int index)
  {
   _size--;
   if (index < _size)
   {
    Array.Copy(_collection, index + 1, _collection, index, (_size - index));
   }

   _collection[_size] = default (T);
  }

  public void Clear()
  {
   if (_size > 0)
   {
    _size = 0;
    Array.Clear(_collection, 0, _size);
    _collection = _emptyArray;
   }
  }

  public void Resize(int newSize)
  {
   Resize(newSize, default (T));
  }

  public void Resize(int newSize, T defaultValue)
  {
   int currentSize = this.Count;
   if (newSize < currentSize)
   {
    this._ensureCapacity(newSize);
   }
   else if (newSize > currentSize)
   {
    if (newSize > this._collection.Length)
     this._ensureCapacity(newSize + 1);
    this.AddRange(Enumerable.Repeat<T>(defaultValue, newSize - currentSize));
   }
  }

  public void Reverse()
  {
   Reverse(0, _size);
  }

  public void Reverse(int startIndex, int count)
  {
   if (count < 0 || startIndex > (_size - count))
   {
    throw new ArgumentOutOfRangeException();
   }

   Array.Reverse(_collection, startIndex, count);
  }

  public void ForEach(Action<T> action)
  {
   if (action == null)
   {
    throw new ArgumentNullException();
   }

   for (int i = 0; i < _size; ++i)
   {
    action(_collection[i]);
   }
  }

  public bool Contains(T dataItem)
  {
   if ((Object)dataItem == null)
   {
    for (int i = 0; i < _size; ++i)
    {
     if ((Object)_collection[i] == null)
      return true;
    }
   }
   else
   {
    EqualityComparer<T> comparer = EqualityComparer<T>.Default;
    for (int i = 0; i < _size; ++i)
    {
     if (comparer.Equals(_collection[i], dataItem))
      return true;
    }
   }

   return false;
  }

  public bool Contains(T dataItem, IEqualityComparer<T> comparer)
  {
   if (comparer == null)
   {
    throw new ArgumentNullException();
   }

   if ((Object)dataItem == null)
   {
    for (int i = 0; i < _size; ++i)
    {
     if ((Object)_collection[i] == null)
      return true;
    }
   }
   else
   {
    for (int i = 0; i < _size; ++i)
    {
     if (comparer.Equals(_collection[i], dataItem))
      return true;
    }
   }

   return false;
  }

  public bool Exists(Predicate<T> searchMatch)
  {
   return (FindIndex(searchMatch) != -1);
  }

  public int FindIndex(Predicate<T> searchMatch)
  {
   return FindIndex(0, _size, searchMatch);
  }

  public int FindIndex(int startIndex, Predicate<T> searchMatch)
  {
   return FindIndex(startIndex, (_size - startIndex), searchMatch);
  }

  public int FindIndex(int startIndex, int count, Predicate<T> searchMatch)
  {
   if (count < 0 || startIndex > (_size - count))
   {
    throw new ArgumentOutOfRangeException();
   }

   if (searchMatch == null)
   {
    throw new ArgumentNullException();
   }

   int endIndex = startIndex + count;
   for (int index = startIndex; index < endIndex; ++index)
   {
    if (searchMatch(_collection[index]) == true)
     return index;
   }

   return -1;
  }

  public int IndexOf(T dataItem)
  {
   return IndexOf(dataItem, 0, _size);
  }

  public int IndexOf(T dataItem, int startIndex)
  {
   return IndexOf(dataItem, startIndex, _size);
  }

  public int IndexOf(T dataItem, int startIndex, int count)
  {
   if (count < 0 || startIndex > (_size - count))
   {
    throw new ArgumentOutOfRangeException();
   }

   return Array.IndexOf(_collection, dataItem, startIndex, count);
  }

  public T Find(Predicate<T> searchMatch)
  {
   if (searchMatch == null)
   {
    throw new ArgumentNullException();
   }

   for (int i = 0; i < _size; ++i)
   {
    if (searchMatch(_collection[i]))
    {
     return _collection[i];
    }
   }

   return default (T);
  }

  public ArrayList<T> FindAll(Predicate<T> searchMatch)
  {
   if (searchMatch == null)
   {
    throw new ArgumentNullException();
   }

   ArrayList<T> matchedElements = new ArrayList<T>();
   for (int i = 0; i < _size; ++i)
   {
    if (searchMatch(_collection[i]))
    {
     matchedElements.Add(_collection[i]);
    }
   }

   return matchedElements;
  }

  public ArrayList<T> GetRange(int startIndex, int count)
  {
   if (count < 0 || startIndex > (_size - count))
   {
    throw new ArgumentOutOfRangeException();
   }

   var newArrayList = new ArrayList<T>(count);
   Array.Copy(_collection, startIndex, newArrayList._collection, 0, count);
   newArrayList._size = count;
   return newArrayList;
  }

  public T[] ToArray()
  {
   T[] newArray = new T[Count];
   if (Count > 0)
   {
    Array.Copy(_collection, 0, newArray, 0, Count);
   }

   return newArray;
  }

  public List<T> ToList()
  {
   var newList = new List<T>(this.Count);
   if (this.Count > 0)
   {
    for (int i = 0; i < this.Count; ++i)
    {
     newList.Add(_collection[i]);
    }
   }

   return newList;
  }

  public string ToHumanReadable(bool addHeader = false)
  {
   int i = 0;
   string listAsString = string.Empty;
   string preLineIndent = (addHeader == false ? "" : "\t");
   for (i = 0; i < Count; ++i)
   {
    listAsString = String.Format("{0}{1}[{2}] => {3}\r\n", listAsString, preLineIndent, i, _collection[i]);
   }

   if (addHeader == true)
   {
    listAsString = String.Format("ArrayList of count: {0}.\r\n(\r\n{1})", Count, listAsString);
   }

   return listAsString;
  }

  public IEnumerator<T> GetEnumerator()
  {
   for (int i = 0; i < Count; i++)
   {
    yield return _collection[i];
   }
  }

  System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
  {
   return this.GetEnumerator();
  }
 }
}

namespace DS.Trees
{
}

#endregion
#region Algorithms
namespace AL.Common
{
}

namespace AL.Graphs
{
}

namespace AL.Numeric
{
}

namespace AL.Sorting
{
 public static class QuickSorter
 {
  public static void QuickSort<T>(this IList<T> collection, Comparer<T> comparer = null)
  {
   int startIndex = 0;
   int endIndex = collection.Count - 1;
   comparer = comparer ?? Comparer<T>.Default;
   collection.InternalQuickSort(startIndex, endIndex, comparer);
  }

  private static void InternalQuickSort<T>(this IList<T> collection, int leftmostIndex, int rightmostIndex, Comparer<T> comparer)
  {
   if (leftmostIndex < rightmostIndex)
   {
    int wallIndex = collection.InternalPartition(leftmostIndex, rightmostIndex, comparer);
    collection.InternalQuickSort(leftmostIndex, wallIndex - 1, comparer);
    collection.InternalQuickSort(wallIndex + 1, rightmostIndex, comparer);
   }
  }

  private static int InternalPartition<T>(this IList<T> collection, int leftmostIndex, int rightmostIndex, Comparer<T> comparer)
  {
   int wallIndex, pivotIndex;
   pivotIndex = rightmostIndex;
   T pivotValue = collection[pivotIndex];
   wallIndex = leftmostIndex;
   for (int i = leftmostIndex; i <= (rightmostIndex - 1); i++)
   {
    if (comparer.Compare(collection[i], pivotValue) <= 0)
    {
     collection.Swap(i, wallIndex);
     wallIndex++;
    }
   }

   collection.Swap(wallIndex, pivotIndex);
   return wallIndex;
  }
 }
}
#endregion
#endif

using System;
class P
{
    static void Main(string[] args)
    {
        string[] i = Console.ReadLine().Split(' ');
        int a = int.Parse(i[0]);
        int b = int.Parse(i[1]);
        string c = Console.ReadLine();
        char[] d = c.ToCharArray();
        for (int j = 0; j < b; j++)
        {
            for (int k = 0; k < d.Length - 1; k++)
            {
                if (d[k].Equals('B') && d[k + 1].Equals('G'))
                {
                    d[k] = 'G';
                    d[k + 1] = 'B';
                    k++;
                }
            }
        }
        Console.WriteLine(d);
    }
}

using System;
using System.Linq;

namespace Zada4ki
{
    class Program
    {
        static void Main(string[] args)
        {
            int t = int.Parse(Console.ReadLine().Split(' ')[1]);
            string s = Console.ReadLine();
            for (int i = 0; i < t; i++) s = s.Replace("BG", "GB");
            Console.WriteLine(s);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication42
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] m = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            int n = m[0];
            int t = m[1];
            string str = Console.ReadLine();
            char[] ch = str.ToCharArray();
            for(int i = 0; i<t; i++)
            {
                for (int j = 0; j < n-1; j++)
                {
                    if (ch[j] == 'B' && ch[j + 1] == 'G')
                    {
                        ch[j] = 'G';
                        ch[j + 1] = 'B';
                        j++;
                    }

                }

            }
            foreach (var e in ch)
                Console.Write(e);

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace _1A
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] w = Console.ReadLine().Split(' ');
            int n = int.Parse(w[0]);
            int t = int.Parse(w[1]);
            string s=Console.ReadLine();
            char [] c=s.ToCharArray(0,n);
            for (int i = 1; i <= t; i++)
            {
                for (int k = 0; k < n-1; k++)
                {
                    if (c[k] == 'B' && c[k + 1] == 'G')
                    {
                        c[k] = 'G';
                        c[k + 1] = 'B';
                        k++;
                    }
                }
            }
            string ans =  new string(c);
            Console.WriteLine(ans);
              //  Console.ReadKey();
        }

    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Очередь_в_школе
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] nt = Console.ReadLine().Split();

            int n = Convert.ToInt32(nt[0]);
            int t = Convert.ToInt32(nt[1]);

            string gb = Console.ReadLine();
            char[] mas = new char[n];

            for (int i = 0; i < n; i++)
            {
                mas[i] = gb[i];
            }

            for (int i = 0; i < t; i++)
            {
                for (int j = 1; j < n; j++)
                {
                    if (mas[j] == 'G' && mas[j - 1] == 'B')
                    {
                        char temp = mas[j];
                        mas[j] = mas[j - 1];
                        mas[j - 1] = temp;
                        j++;
                    }
                }
            }

            for (int i = 0; i < n; i++)
            {
                Console.Write(mas[i]);
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using System.IO;
using System.Numerics;

namespace probleme {
    class Program {
        static void Main(string[] args) {
            string[] s = Console.ReadLine().Split(' ');
            int n = int.Parse(s[0]), t = int.Parse(s[1]);
            char[] v = Console.ReadLine().ToCharArray();
            for (int i = 0; i < t; i++) {
                for (int j = 0; j < n - 1; j++) {
                    if (v[j] == 'B' && v[j + 1] == 'G') {
                        v[j] = 'G';
                        v[j + 1] = 'B';
                        j++;
                    }
                }
            }
            for (int i = 0; i < n; i++) {
                Console.Write(v[i]);
            }
            //Console.ReadKey();
        }
    }
}

using System;

public class Program
{
	public static void Main()
	{
		var line1=Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
		var s=Console.ReadLine().ToCharArray();

		for(int j=0; j<line1[1]; j++)
		{
		for(int i=0; i<line1[0]-1; i++)
		{
			if(s[i]=='B' && s[i+1]=='G')
			{
				s[i]='G';
				s[i+1]='B';
				i++;
			}
		}

		}
		for(int k=0; k<line1[0]; k++)
		{
			Console.Write(s[k]);
		}
	}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Queue_at_the_School
{
    class Program
    {
        static void Main(string[] args)
        {
            int sumB =0;
            string line = Console.ReadLine();
            string line1 = Console.ReadLine();
            int n = Convert.ToInt16(line.Substring(0, line.IndexOf(' ')));
            int x = Convert.ToInt16(line.Substring(line.IndexOf(' ')+1));
            int counter = 0;
            int counter1 = 0;
            for (int i = 0; i < line1.Length; i++)
            {
                if (line1[i] == 'B')
                {
                    sumB++;
                }
            }
            int[] posB = new int[sumB];
            int[] numG = new int[sumB];
            for (int i = 0; i < line1.Length; i++)
            {
                if (line1[i] == 'B')
                {
                    posB[counter] = i;
                    counter++;
                }
            }
            counter = 0;
            for (int i = line1.IndexOf('B')+1; i < line1.Length; i++)
            {
                if (line1[i] == 'B')
                {
                    numG[counter] = counter1;
                    counter++;
                    counter1 = 0;
                }
                else counter1++;
                if (i == line1.Length - 1)
                {
                    try
                    {
                        numG[counter] = counter1;
                    }
                    catch { break;}
                    break;
                }
            }
            for (int i = 0; i < x; i++)
            {
                for (int j = 0; j < line1.Length; j++)
                {
                    if (line1[j]!='G')
                    {
                        if (j == line1.Length - 1) break;
                        if (line1[j + 1] == 'G')
                        {
                            line1 = line1.Remove(j, 1);
                            line1 = line1.Insert(j + 1, "B");
                            j++;
                        }
                    }
                }
            }
                Console.WriteLine(line1);
        }
    }
}

using System;
using System.Linq;
using System.Text;

namespace QueueAtTheSchool
{
    class Program
    {
        static void Main(string[] args)
        {
            var nt = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            //var n = nt[0];
            var t = nt[1];
            var queue = new StringBuilder(Console.ReadLine());
            for (int i = 0; i < t; i++)
            {
                queue = queue.Replace(oldValue: "BG", newValue: "GB");
            }
            Console.WriteLine(queue);
            //Console.ReadLine();
        }
    }
}

using System;
using System.Text;

namespace CS
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] arr = Console.ReadLine().Split(' ');
            int len = int.Parse(arr[0]), time = int.Parse(arr[1]);
            StringBuilder input = new StringBuilder(Console.ReadLine());
            for (int i = 0; i < time; i++)
            {
                for (int j = 0; j < len - 1; j++)
                    if (input[j] == 'B' && input[j + 1] == 'G')
                    {
                        input[j] = 'G'; input[j + 1] = 'B'; j++;
                    }
            }
            Console.WriteLine(input);
        }
    }
}

using System;

namespace QueueTask
{
    class Program
    {
        static void Main(string[] args)
        {

            string[] StartValue = Console.ReadLine().Split(' ');
            int CountOfHumans = int.Parse(StartValue[0]);
            int HowMaNyTimes = int.Parse(StartValue[1]);
            string Children = Console.ReadLine();
            char[] chs = new char[Children.Length];
            for(int i = 0; i < Children.Length;i++)
            {
                chs[i] = Children[i];
            }

            int count = 0;
            bool[] YesOrNo = new bool[chs.Length];
            while (count < HowMaNyTimes)
            {
                for(int i = 0; i < chs.Length; i++)
                {
                    if (i + 1 < chs.Length)
                    {
                        if (chs[i] == 'B' && chs[i + 1] == 'G' && !YesOrNo[i])
                        {
                            char tmp = chs[i];
                            chs[i] = chs[i + 1];
                            chs[i + 1] = tmp;
                            YesOrNo[i + 1] = true;
                        }
                    }
                }
                count++;
                YesOrNo = new bool[chs.Length];
            }
            foreach (char c in chs)
                Console.Write(c);
            Console.WriteLine();
        }
    }
}

using System;
using System.Linq;

class Program
{
    static void Main()
    {
        string[] str1 = Console.ReadLine().Split(' ');
        byte n = Byte.Parse(str1[0]);
        byte t = Byte.Parse(str1[1]);
        char[] str = Console.ReadLine().ToArray();
        byte j = 0;
        while(j<t)
        {
            for (int i=0;i<str.Length-1;i++)
            {
                if((str[i]=='B')&&(str[i+1]=='G'))
                {
                    char temp = str[i];
                    str[i] = str[i + 1];
                    str[i + 1] = temp;
                    i++;
                }
            }
            j++;
        }
        for (int i=0;i<str.Length;i++)
        {
            Console.Write(str[i]);
        }
    }
}

using System;

 class B266
 {
     static void Main(string[] args)
     {
         var arr = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
         var str = Console.ReadLine();

         for(int i=0;i<arr[1];i++)
         {
             str = str.Replace("BG", "GB");
         }
         Console.WriteLine(str);
     }
 }

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TestApp
{
    class Program
    {
        static void Main(string[] arguments)
        {
            int[] args = ReadIntArray();
            int n = args[0];
            int t = args[1];
            char[] line = Console.ReadLine().ToCharArray();
            for (int i = 0; i < t; i++ )
            {
                int k = 0;
                while (k < n-1)
                    if ((line[k] == 'B') && (line[k+1] == 'G'))
                    {
                        line[k] = 'G';
                        line[k+1] = 'B';
                        k+=2;
                    }
                    else
                        k++;
            }
            for (int i = 0; i< n; i++)
                Console.Write(line[i]);
            Console.ReadLine();
        }

        static int[] ReadIntArray ()
        {
            return Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        }

        static int ReadInt ()
        {
            return int.Parse(Console.ReadLine());
        }

    }

    public static class NumConverter
    {
        public static int ToOne (int num)
        { return num == 0 ? 0 : 1; }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Fun
{
	class Program
	{
		static void Swap<T>(ref T a, ref T b)
		{
			T t = a;
			a = b;
			b = t;
		}

		static void Main(string[] args)
		{
			var t = int.Parse(Console.ReadLine().Split(' ')[1]);
			var q = Console.ReadLine().ToCharArray();

			while (t > 0)
			{
				for (int i = 1; i < q.Length; i++)
				{
					if (q[i - 1] == 'B' && q[i] == 'G')
					{
						Swap(ref q[i - 1], ref q[i]);
						i++;
					}
				}
				t--;
			}
			Console.WriteLine(string.Concat(q.Select(p => p.ToString()).ToArray()));
		}
	}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1A
{
  class Program266B
  {
    static void Main(string[] args)
    {
      string[] tk = Console.ReadLine().Split(' ');
      int n = Convert.ToInt32(tk[1]);
      string s = Console.ReadLine();
      char[] ca = s.ToCharArray();

      for (int i = 0; i < n; i++)
      {
        for (int j = 0; j < s.Length - 1; j++)
        {
          if (ca[j] == 'B' && ca[j + 1] == 'G')
          {
            ca[j] = 'G';
            ca[j + 1] = 'B';
            j++;
          }
        }
      }

      foreach (char c in ca)
      Console.Write(c);
    }
  }
}

using System;

class Program {
    static void Main(string[] args) {

        string[] firstLine = Console.ReadLine().Split(' ');
        int n = Convert.ToInt32(firstLine[0]);
        int t = Convert.ToInt32(firstLine[1]);

        string strQueue = Console.ReadLine();
        char[] queue = strQueue.ToCharArray();

        for (int k = 0; k < t; k++) {
            for (int i = 0; i < n - 1; i++) {
                if (queue[i] == 'B' && queue[i + 1] == 'G') {
                    queue[i + 1] = 'B';
                    queue[i] = 'G';
                    i++;
                }
            }
        }

        for (int i = 0; i < n; i++) {
            Console.Write(queue[i]);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace QueueSchool
{
    class Program
    {
        static void Main(string[] args)
        {
            var data = Array.ConvertAll(Console.ReadLine().Split(' '), s => Int32.Parse(s));
            var input = Console.ReadLine().ToCharArray();

            int num = data[0] - 2;
            int count = 1;
            char temp = 'A';

            while (count <= data[1])
            {
                for (int i = 0; i <= num;)
                {
                    if (input[i] == 'B' && input[i + 1] == 'G')
                    {
                        temp = input[i + 1];
                        input[i + 1] = input[i];
                        input[i] = temp;
                        i += 2;
                    }
                    else
                    {
                        i++;
                    }
                }
                count++;
            }
            Console.WriteLine(new string(input));
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace B.Очередь_в_школе
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            string[] values = input.Split(' ');
            int n = Convert.ToInt32(values[0]);
            int t = Convert.ToInt32(values[1]);
            string que = Console.ReadLine();
            for (int i = 0; i < t; i++)
            {
                que = que.Replace("BG", "GB");
            }
            Console.WriteLine(que);
            Console.ReadLine();
        }
    }
}

using System;
using System.Linq;

namespace QueueattheSchool
{
	class MainClass
	{
		public static void Main (string[] args)
		{
				var str = Console.ReadLine ().Split (' ');
				int n = int.Parse (str [0]);
				int t = int.Parse (str [1]);

				string input = Console.ReadLine ();

				var s = input.ToCharArray ();

				for (int i = 0; i < t; i++) {
					for (int j = 0; j < n - 1; j++) {
						if (s [j] == 'B' && s [j + 1] == 'G') {
							s[j] = 'G'; s[j + 1] = 'B';
							j++;
						}
					}
				}

				var output = "";
				s.ToList ().ForEach (c=> output+=c);
				Console.WriteLine (output);

		}
	}
}

using System;
using System.Linq;

class m
{
    static void Main()
    {
        string[] cin = Console.ReadLine().Split();
        int count = Convert.ToInt32(cin[0]),
            time = Convert.ToInt32(cin[1]);
        char[] seq = Console.ReadLine().ToArray();
        for (int t = 0; t < time; t++)
            for (int pos = 0; pos < count - 1; pos++)
                if (seq[pos] == 'B' && seq[pos+1] == 'G')
                {
                    seq[pos] = 'G';
                    seq[pos + 1] = 'B';
                    pos++;
                }
        Console.WriteLine(seq);
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Queue
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split();
            int n = int.Parse(input[0]);
            int t = int.Parse(input[1]);
            string s = Console.ReadLine();
            char[] output = new char[n];
            int k = 0;
            foreach (char c in s)
            {
                output[k] = c;
                k++;
            }
            for (int i = 0, x = 0; i < t; i++)
            {
                for (int j = x + 1; j < output.Length; j = x + 1)
                {
                    if (output[x] == 'B' && output[j] == 'G')
                    {
                        output[x] = 'G';
                        output[j] = 'B';
                        x = j + 1;
                    }
                    else
                    {
                        x = x + 1;
                    }
                }
                x = 0;
            }
            foreach (char c in output)
            {
                Console.Write(c);
            }
            Console.WriteLine();
        }
    }
}

using System;
class Program
    {
        static void Main(string[] args)
        {
            char[] line;
            int timeOffset;
            int length;
            {
                string[] input = Console.In.ReadToEnd().Split(new char[] { ' ', '\n', '\r', '\t' }, StringSplitOptions.RemoveEmptyEntries);
                line = input[2].ToCharArray();
                timeOffset = int.Parse(input[1]);
                length = int.Parse(input[0]);
            }
            {
                char temp;
                for (int i = 0; i < timeOffset; ++i)
                {
                    for (int j = length - 1; j > 0; --j)
                    {
                        if (line[j] == 'G' && line[j - 1] == 'B')
                         { temp = line[j]; line[j] = line[j - 1]; line[j - 1] = temp; --j; }
                    }
                }
            }
            Console.WriteLine(new string(line));
        }
    }

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication16
{
    class Program
    {
        static void Main(string[] args)
        {
            var init = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            var amount = init[0];
            var iter = init[1];

            var children = Console.ReadLine();
            char[] child = children.ToArray();

            for (int i = 0; i < iter; i++)
            {
                for (int j = 1; j < children.Length; j++)
                {
                    if (child[j - 1] == 'B' && child[j] == 'G')
                    {
                        char temp = child[j - 1];
                        child[j - 1] = child[j];
                        child[j] = temp;
                        j++;
                    }
                }
            }

            children = String.Join("", child);
            Console.WriteLine(children);
                Console.ReadLine();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _266B
{
    class Program
    {
        static void Main(string[] args)
        {
            var arr = Console.ReadLine().Split(' ');
            int n = Convert.ToInt32(arr[0]);
            int t = Convert.ToInt32(arr[1]);
            var position = Console.ReadLine().ToCharArray();
            for (int i = 0; i < t; i++)
            {
                for (int j = 1; j < position.Length; j++)
                {
                    if (position[j]=='G' && position[j - 1] == 'B')
                    {
                        position[j] = 'B';
                        position[j - 1] = 'G';
                        j++;

                    }
                }
            }
            for (int i = 0; i < position.Length; i++)
            {
                Console.Write(position[i]);
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication7
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] n = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            string s = Console.ReadLine();
            for (int i = 0; i < n[1]; i++)
            {
                s = s.Replace("BG", "GB");
            }
            Console.WriteLine(s);

        }
    }
}

using System;
using System.Linq;

public class QueueAtTheSchool
{
    private static void Main()
    {
    	var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
    	var n = input[0];
		var t = input[1];
		var queue = Console.ReadLine().ToCharArray();

		for (int i = 0; i < t; i++)
		{
			var j = 0;
			while(j < n - 1)
			{
				if(queue[j] == 'B' && queue[j + 1] == 'G')
				{
					Swap(queue, j, j + 1);
					j++;
				}

				j++;
			}
		}

    	Console.WriteLine(string.Join("", queue));
    }

	private static void Swap(char[] input, int a, int b)
	{
		var temp = input[a];
		input[a] = input[b];
		input[b] = temp;
	}
}

using System;

class B266 {
    public static void Main() {
        var line = Console.ReadLine().Split();
        var n = int.Parse(line[0]);
        var t = int.Parse(line[1]);
        var s = Console.ReadLine().ToCharArray();
        for (int i = 0; i < t; ++i)
            for (int j = 0; j < n - 1; ++j)
                if (s[j] < s[j + 1]) {
                    var sj = s[j];
                    s[j] = s[j + 1];
                    s[j + 1] = sj;
                    ++j;
                }
        Console.WriteLine(new string(s));
    }
}

using System;
using System.Text;
using System.Linq;

namespace Test
{
    class Program
    {
        static void Main(string[] args)
        {
            byte time = Console.ReadLine().Split(' ').Select(n => Convert.ToByte(n)).ToArray()[1];
            StringBuilder queue = new StringBuilder(Console.ReadLine());

            for (int j = 0; j < time; j++)
            {
                for (int i = 1; i < queue.Length; i++)
                {
                    if (queue[i] == 'G' && queue[i - 1] == 'B')
                    {
                        queue[i] = 'B';
                        queue[i - 1] = 'G';
                        i++;
                    }
                }
            }

            Console.WriteLine(queue);
        }

    }
}

using System;
using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using System.Threading.Tasks;

namespace Problem266B {
    class Program {
        static void Main(string[] args) {
            string[] inputInfo = Console.ReadLine().Split(' ');
            int childrens = Convert.ToInt32(inputInfo[0]);
            int time = Convert.ToInt32(inputInfo[1]);
            char[] queue = Console.ReadLine().ToCharArray();

            for (int i = 0; i < time; i++) {
                swapPositions(queue, childrens);
            }

            for (int i = 0; i < childrens; i++) {
                Console.Write(queue[i]);
            }
            Console.Write(Environment.NewLine);
        }

        private static void swapPositions(char[] queue, int childrens) {
            List<int> positions = positionsToSwap(queue, childrens);
            int positionsCount = positions.Count;

            for (int i = 0; i < positionsCount; i++) {
                int Gposition = positions[i];
                queue[Gposition - 1] = 'G';
                queue[Gposition] = 'B';
            }
        }

        private static List<int> positionsToSwap(char[] queue, int childrens) {
            List<int> positions = new List<int>();
            for (int i = 1; i < childrens; i++) {
                if (queue[i].Equals('G') && queue[i - 1].Equals('B')) {
                    positions.Add(i);   //add position of G
                }
            }
            return positions;
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CodeForcePreparing
{
    class Programm
    {
        static void Main(string[] args)
        {
            string[] input_vals = Console.ReadLine().Split(' ');
            char[] input_array = Console.ReadLine().ToCharArray();
            char change;
            for (int i = 0; i < Convert.ToInt32(input_vals[1]); i++)
            {
                for (int k = 0; k < input_array.Length - 1; k++)
                {
                    if (input_array[k + 1] == 'G' && input_array[k] == 'B')
                    {
                        change = input_array[k];
                        input_array[k] = input_array[k + 1];
                        input_array[k + 1] = change;
                        k++;
                    }
                }
            }
            for (int i = 0; i < input_array.Length; i++)
                Console.Write(input_array[i]);
        }
    }
}

using System;

namespace CodeForce
{
    class _266B_Queue_At_The_School
    {
        static void Main()
        {
            int loopCount = int.Parse(Console.ReadLine().Split(' ')[1]);
            char[] charInputs = Console.ReadLine().ToCharArray();

            SortBNG(ref charInputs, loopCount);
        }

        static void SortBNG(ref char[] input, int loopCount)
        {
            if(loopCount == 0)
            {
                foreach(char c in input)
                {
                    Console.Write(c);
                }
                Console.WriteLine();
                return;
            }

            for(int i = 0; i < input.Length - 1; i++)
            {
                if(input[i] == 'B' && input[i+1] == 'G')
                {
                    input[i] ^= input[i + 1];
                    input[i + 1] ^= input[i];
                    input[i] ^= input[i + 1];
                    i++;
                }
            }

            SortBNG(ref input, --loopCount);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] Arr = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            string s = Console.ReadLine();
            for (int i = 0; i < Arr[1]; i++)
                s = s.Replace("BG","GB");
            Console.WriteLine(s);
            Console.ReadLine();
        }
    }
}

using System;
using System.Linq;
class Program
{
    public static void Swap<T>(ref T a, ref T b)
    {
        T temp = a;
        a = b;
        b = temp;
    }
    static void Main()
    {
        var nt = Console.ReadLine().Split(' ').Select(int.Parse);
        var n = nt.First();
        var t = nt.Last();
        var s = Console.ReadLine();
        var sa = s.ToCharArray();
        int i, j;
        for (i = 0; i < t; i++)
        {
            j = 0;
            while (j < s.Length)
            {
                var newS = new string(sa);
                j = newS.IndexOf("BG", j);
                if (j >= 0)
                {
                    Swap(ref sa[j], ref sa[j + 1]);
                }
                else
                {
                    break;
                }
                j += 2;
            }
        }
        Console.WriteLine(sa);
    }
}

using System;
using System.Collections.Generic;
using System.Text;

namespace C0deforces
{
    class QueueAtTheSchool
    {
       static void Main(string[] args)
        {
            int[] NandT = Array.ConvertAll(Console.ReadLine().Trim().Split(' '), int.Parse);
            char[] s = Console.ReadLine().Trim().ToCharArray();
            while (NandT[1]-- > 0)
            {
                for (int i = 0; i < s.Length - 1; i++)
                {
                    if (s[i] == 'B' && s[i + 1] == 'G') { s[i + 1] = 'B'; s[i] = 'G'; i++; }
                }
            }
            Console.WriteLine(string.Join("",s));
        }
    }
}

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    public static class MainClass
    {
        const int BufferSize = (1 << 10) * 10;

        static readonly StreamReader Reader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);
        static readonly StreamWriter Writer = new StreamWriter(Console.OpenStandardOutput(BufferSize), Encoding.ASCII, BufferSize, false);

        static void Main(string[] args)
        {
            var thread = new Thread(Solve) {Priority = ThreadPriority.Highest};
            thread.Start();
            //Solve();

            //Console.ReadKey();
        }

        static void Solve()
        {
            var n = NextNumber();
            var t = NextNumber();

            var queue = new List<char>();
            for (var i = 0; i < n; )
            {
                var symbol = (char) Reader.Read();

                if (char.IsLetter(symbol))
                {
                    queue.Add(symbol);
                    i++;
                }
            }

            for (var i = 0; i < t; i++)
            {
                for (var j = 0; j < n - 1; j++)
                {
                    if (queue[j] == 'B' && queue[j + 1] == 'G')
                    {
                        Swap(queue, j, j + 1);
                        j++;
                    }
                }
            }

            Writer.Write(String.Join("", queue));
            Writer.Flush();
        }

        static void ReverseArray(ref int[] array, int left, int right)
        {
            if (right < left) return;

            var middle = left + (right - left) / 2;
            for (var i = left; i <= middle; i++)
            {
                Swap(ref array[i], ref array[right + left - i]);
            }
        }

        static void Swap<T>(ref T firstElement, ref T secondElement)
        {
            var temp = firstElement;
            firstElement = secondElement;
            secondElement = temp;
        }

        static void Swap<T>(IList<T> collection, int firstIndex, int secondIndex)
        {
            var temp = collection[firstIndex];
            collection[firstIndex] = collection[secondIndex];
            collection[secondIndex] = temp;
        }

        static int NextNumber()
        {
            var resultNumber = 0;
            var isNegative = false;
            int symbol;

            do
            {
                symbol = Reader.Read();
                switch (symbol)
                {
                    case '-':
                        isNegative = true;
                        break;
                    case '.':
                        return 1;
                    case -1:
                        return isNegative ? -resultNumber : resultNumber;
                }

                if (symbol >= 'a' && symbol <= 'z')
                {
                    return -1;
                }
            } while (symbol < '0' || symbol > '9');

            resultNumber = symbol - '0';
            while (true)
            {
                symbol = Reader.Read();
                if (symbol < '0' || symbol > '9')
                {
                    return isNegative ? -resultNumber : resultNumber;
                }

                resultNumber *= 10;
                resultNumber += symbol - '0';
            }
        }

        static int ReadNumber()
        {
            return int.Parse(Reader.ReadLine());
        }

        static long ReadLongNumber()
        {
            return long.Parse(Reader.ReadLine());
        }

        static int[] ReadArray()
        {
            var inputLine = Reader.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

            var resultArray = new int[inputLine.Length];
            for (var i = 0; i < inputLine.Length; i++)
            {
                resultArray[i] = int.Parse(inputLine[i]);
            }

            return resultArray;
        }
    }
}

using System;

namespace Queue_at_the_School
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] s = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            char[] q = Console.ReadLine().ToCharArray();
            int i = 0;
            while (s[1] != 0)
            {
                while (i < q.Length - 1)
                {
                    if (q[i] == 'B' && q[i + 1] == 'G')
                    {
                        q[i] = 'G';
                        q[i + 1] = 'B';
                        i++;
                    }
                    i++;
                }
                s[1]--;
                i = 0;
            }
            Console.WriteLine(q);
            Console.ReadLine();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    public static class MainClass
    {
        const int BufferSize = (1 << 10) * 10;

        static readonly StreamReader Reader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);
        static readonly StreamWriter Writer = new StreamWriter(Console.OpenStandardOutput(BufferSize), Encoding.ASCII, BufferSize, false);

        static void Main(string[] args)
        {
            //var thread = new Thread(Solve) {Priority = ThreadPriority.Highest};
            //thread.Start();
            Solve();

            //Console.ReadKey();
        }

        static void Solve()
        {
            var n = NextNumber();
            var t = NextNumber();

            Reader.Read();

            var queue = new char[n + 1];
            for (var i = 0; i < n; i++)
            {
                queue[i] = (char) Reader.Read();
            }

            for (var i = 0; i < t; i++)
            {
                for (var j = 0; j < n - 1; j++)
                {
                    if (queue[j] == 'B' && queue[j + 1] == 'G')
                    {
                        Swap(ref queue[j], ref queue[j + 1]);
                        j++;
                    }
                }
            }

            for (var i = 0; i < n; i++)
            {
                Writer.Write(queue[i]);
            }

            Writer.Flush();
        }

        static void ReverseArray(ref int[] array, int left, int right)
        {
            if (right < left) return;

            var middle = left + (right - left) / 2;
            for (var i = left; i <= middle; i++)
            {
                Swap(ref array[i], ref array[right + left - i]);
            }
        }

        static void Swap<T>(ref T firstElement, ref T secondElement)
        {
            var temp = firstElement;
            firstElement = secondElement;
            secondElement = temp;
        }

        static void Swap<T>(IList<T> collection, int firstIndex, int secondIndex)
        {
            var temp = collection[firstIndex];
            collection[firstIndex] = collection[secondIndex];
            collection[secondIndex] = temp;
        }

        static int NextNumber()
        {
            var resultNumber = 0;
            var isNegative = false;
            int symbol;

            do
            {
                symbol = Reader.Read();
                switch (symbol)
                {
                    case '-':
                        isNegative = true;
                        break;
                    case '.':
                        return 1;
                    case -1:
                        return isNegative ? -resultNumber : resultNumber;
                }

                if (symbol >= 'a' && symbol <= 'z')
                {
                    return -1;
                }
            } while (symbol < '0' || symbol > '9');

            resultNumber = symbol - '0';
            while (true)
            {
                symbol = Reader.Read();
                if (symbol < '0' || symbol > '9')
                {
                    return isNegative ? -resultNumber : resultNumber;
                }

                resultNumber *= 10;
                resultNumber += symbol - '0';
            }
        }

        static int ReadNumber()
        {
            return int.Parse(Reader.ReadLine());
        }

        static long ReadLongNumber()
        {
            return long.Parse(Reader.ReadLine());
        }

        static int[] ReadArray()
        {
            var inputLine = Reader.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

            var resultArray = new int[inputLine.Length];
            for (var i = 0; i < inputLine.Length; i++)
            {
                resultArray[i] = int.Parse(inputLine[i]);
            }

            return resultArray;
        }
    }
}

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    public static class MainClass
    {
        const int BufferSize = (1 << 10) * 10;

        static readonly StreamReader Reader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);
        static readonly StreamWriter Writer = new StreamWriter(Console.OpenStandardOutput(BufferSize), Encoding.ASCII, BufferSize, false);

        static void Main(string[] args)
        {
            //var thread = new Thread(Solve) {Priority = ThreadPriority.Highest};
            //thread.Start();
            Solve();

            //Console.ReadKey();
        }

        static void Solve()
        {
            var n = NextNumber();
            var t = NextNumber();

            Reader.Read();

            var queue = new List<char>(n);
            for (var i = 0; i < n; i++)
            {
                queue.Add((char) Reader.Read());
            }

            for (var i = 0; i < t; i++)
            {
                for (var j = 0; j < n - 1; j++)
                {
                    if (queue[j] == 'B' && queue[j + 1] == 'G')
                    {
                        Swap(queue, j, j + 1);
                        j++;
                    }
                }
            }

            for (var i = 0; i < n; i++)
            {
                Writer.Write(queue[i]);
            }

            Writer.Flush();
        }

        static void ReverseArray(ref int[] array, int left, int right)
        {
            if (right < left) return;

            var middle = left + (right - left) / 2;
            for (var i = left; i <= middle; i++)
            {
                Swap(ref array[i], ref array[right + left - i]);
            }
        }

        static void Swap<T>(ref T firstElement, ref T secondElement)
        {
            var temp = firstElement;
            firstElement = secondElement;
            secondElement = temp;
        }

        static void Swap<T>(IList<T> collection, int firstIndex, int secondIndex)
        {
            var temp = collection[firstIndex];
            collection[firstIndex] = collection[secondIndex];
            collection[secondIndex] = temp;
        }

        static int NextNumber()
        {
            var resultNumber = 0;
            var isNegative = false;
            int symbol;

            do
            {
                symbol = Reader.Read();
                switch (symbol)
                {
                    case '-':
                        isNegative = true;
                        break;
                    case '.':
                        return 1;
                    case -1:
                        return isNegative ? -resultNumber : resultNumber;
                }

                if (symbol >= 'a' && symbol <= 'z')
                {
                    return -1;
                }
            } while (symbol < '0' || symbol > '9');

            resultNumber = symbol - '0';
            while (true)
            {
                symbol = Reader.Read();
                if (symbol < '0' || symbol > '9')
                {
                    return isNegative ? -resultNumber : resultNumber;
                }

                resultNumber *= 10;
                resultNumber += symbol - '0';
            }
        }

        static int ReadNumber()
        {
            return int.Parse(Reader.ReadLine());
        }

        static long ReadLongNumber()
        {
            return long.Parse(Reader.ReadLine());
        }

        static int[] ReadArray()
        {
            var inputLine = Reader.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

            var resultArray = new int[inputLine.Length];
            for (var i = 0; i < inputLine.Length; i++)
            {
                resultArray[i] = int.Parse(inputLine[i]);
            }

            return resultArray;
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace code
{
    class Wight
    {

        static void Main(string[] args)
        {

            string[] lines = new string[2];

            for(int i=0; i<lines.Length;i++)
            {
                lines[i]= Console.ReadLine();
            }

           string[] counts = lines[0].Split(' ');

            int count= Convert.ToInt16(counts[0]);

            int index= Convert.ToInt16(counts[1]);

            char[]queue=   lines[1].ToCharArray();

            //string cha = string.Empty;

            for (int j = 0; j < index; j++)
            {
                for (int i = 0; i < queue.Length-1 ; ++i)
                {
                    if (queue[i] == 'B' && queue[i+1] == 'G')
                    {
                        queue[i]= 'G';
                        queue[i+1]= 'B';

                        i = i + 1;
                    }

                }
            }

              for(int j=0;  j<queue.Length; j++)
            {
                Console.Write(queue[j]);
            }

            Console.WriteLine();

    }
    }
}

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    public static class MainClass
    {
        const int BufferSize = (1 << 10) * 10;

        static readonly StreamReader Reader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);
        static readonly StreamWriter Writer = new StreamWriter(Console.OpenStandardOutput(BufferSize), Encoding.ASCII, BufferSize, false);

        static void Main(string[] args)
        {
            //var thread = new Thread(Solve) {Priority = ThreadPriority.Highest};
            //thread.Start();
            Solve();

            //Console.ReadKey();
        }

        static void Solve()
        {
            var n = NextNumber();
            var t = NextNumber();

            Reader.Read();
            var queue = Reader.ReadLine().ToCharArray();

            for (var i = 0; i < t; i++)
            {
                for (var j = 0; j < n - 1; j++)
                {
                    if (queue[j] == 'B' && queue[j + 1] == 'G')
                    {
                        Swap(ref queue[j], ref queue[j + 1]);
                        j++;
                    }
                }
            }

            for (var i = 0; i < n; i++)
            {
                Writer.Write(queue[i]);
            }

            Writer.Flush();
        }

        static void ReverseArray(ref int[] array, int left, int right)
        {
            if (right < left) return;

            var middle = left + (right - left) / 2;
            for (var i = left; i <= middle; i++)
            {
                Swap(ref array[i], ref array[right + left - i]);
            }
        }

        static void Swap<T>(ref T firstElement, ref T secondElement)
        {
            var temp = firstElement;
            firstElement = secondElement;
            secondElement = temp;
        }

        static void Swap<T>(IList<T> collection, int firstIndex, int secondIndex)
        {
            var temp = collection[firstIndex];
            collection[firstIndex] = collection[secondIndex];
            collection[secondIndex] = temp;
        }

        static int NextNumber()
        {
            var resultNumber = 0;
            var isNegative = false;
            int symbol;

            do
            {
                symbol = Reader.Read();
                switch (symbol)
                {
                    case '-':
                        isNegative = true;
                        break;
                    case '.':
                        return 1;
                    case -1:
                        return isNegative ? -resultNumber : resultNumber;
                }

                if (symbol >= 'a' && symbol <= 'z')
                {
                    return -1;
                }
            } while (symbol < '0' || symbol > '9');

            resultNumber = symbol - '0';
            while (true)
            {
                symbol = Reader.Read();
                if (symbol < '0' || symbol > '9')
                {
                    return isNegative ? -resultNumber : resultNumber;
                }

                resultNumber *= 10;
                resultNumber += symbol - '0';
            }
        }

        static int ReadNumber()
        {
            return int.Parse(Reader.ReadLine());
        }

        static long ReadLongNumber()
        {
            return long.Parse(Reader.ReadLine());
        }

        static int[] ReadArray()
        {
            var inputLine = Reader.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

            var resultArray = new int[inputLine.Length];
            for (var i = 0; i < inputLine.Length; i++)
            {
                resultArray[i] = int.Parse(inputLine[i]);
            }

            return resultArray;
        }
    }
}

using System;
using System.Linq;

class Program {
  static void Main() {
    var t = Console.ReadLine().Split(' ').Select(int.Parse).ToArray()[1];
    var cs = Console.ReadLine().ToCharArray();
    while (t > 0) {
      for (var i = 0 ; i < cs.Length - 1 ; i++) {
        if (cs[i] == 'B' && cs[i+1] == 'G') {
          cs[i] = 'G';
          cs[i+1] = 'B';
          i++;
        }
      }
      t--;
    }
    Console.WriteLine(new string(cs));
  }
}

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    public static class MainClass
    {
        const int BufferSize = (1 << 10) * 10;

        static readonly StreamReader Reader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);
        static readonly StreamWriter Writer = new StreamWriter(Console.OpenStandardOutput(BufferSize), Encoding.ASCII, BufferSize, false);

        static void Main(string[] args)
        {
            //var thread = new Thread(Solve) {Priority = ThreadPriority.Highest};
            //thread.Start();
            Solve();

            //Console.ReadKey();
        }

        static void Solve()
        {
            var n = NextNumber();
            var t = NextNumber();

            var queue = new List<char>(n);
            for (var i = 0; i < n; )
            {
                var symbol = (char) Reader.Read();

                if (char.IsLetter(symbol))
                {
                    queue.Add(symbol);
                    i++;
                }
            }

            for (var i = 0; i < t; i++)
            {
                for (var j = 0; j < n - 1; j++)
                {
                    if (queue[j] == 'B' && queue[j + 1] == 'G')
                    {
                        Swap(queue, j, j + 1);
                        j++;
                    }
                }
            }

            for (var i = 0; i < n; i++)
            {
                Writer.Write(queue[i]);
            }
            Writer.Flush();
        }

        static void ReverseArray(ref int[] array, int left, int right)
        {
            if (right < left) return;

            var middle = left + (right - left) / 2;
            for (var i = left; i <= middle; i++)
            {
                Swap(ref array[i], ref array[right + left - i]);
            }
        }

        static void Swap<T>(ref T firstElement, ref T secondElement)
        {
            var temp = firstElement;
            firstElement = secondElement;
            secondElement = temp;
        }

        static void Swap<T>(IList<T> collection, int firstIndex, int secondIndex)
        {
            var temp = collection[firstIndex];
            collection[firstIndex] = collection[secondIndex];
            collection[secondIndex] = temp;
        }

        static int NextNumber()
        {
            var resultNumber = 0;
            var isNegative = false;
            int symbol;

            do
            {
                symbol = Reader.Read();
                switch (symbol)
                {
                    case '-':
                        isNegative = true;
                        break;
                    case '.':
                        return 1;
                    case -1:
                        return isNegative ? -resultNumber : resultNumber;
                }

                if (symbol >= 'a' && symbol <= 'z')
                {
                    return -1;
                }
            } while (symbol < '0' || symbol > '9');

            resultNumber = symbol - '0';
            while (true)
            {
                symbol = Reader.Read();
                if (symbol < '0' || symbol > '9')
                {
                    return isNegative ? -resultNumber : resultNumber;
                }

                resultNumber *= 10;
                resultNumber += symbol - '0';
            }
        }

        static int ReadNumber()
        {
            return int.Parse(Reader.ReadLine());
        }

        static long ReadLongNumber()
        {
            return long.Parse(Reader.ReadLine());
        }

        static int[] ReadArray()
        {
            var inputLine = Reader.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

            var resultArray = new int[inputLine.Length];
            for (var i = 0; i < inputLine.Length; i++)
            {
                resultArray[i] = int.Parse(inputLine[i]);
            }

            return resultArray;
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            var roundCnt = input[1];
            var que = Console.ReadLine();

            string swapped = string.Empty;
            int iNumber = -1;

            List<Char> newstring = new List<char>();
            newstring.AddRange(que.ToList());

            for (var j = 0; j < roundCnt; j++)
            {
                for (var i = 0; i < newstring.Count; i++)
                {
                    if (i != iNumber)// if not swapped
                    {
                        if ((i + 1 <= newstring.Count - 1) && (newstring[i].ToString() == "B") && (newstring[i + 1].ToString() == "G"))   //if it's B and next one is G
                        {
                            var temp = newstring[i];
                            newstring[i] = newstring[i + 1]; // do swapp
                            newstring[i + 1] = temp;
                            iNumber = i + 1;
                        }
                    }
                }
                iNumber = -1;
            }

            Console.WriteLine(string.Join("", newstring.Select(x => x.ToString())));
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp57
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] inp0 = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int n = inp0[0];
            int t = inp0[1];
            char[] c = Console.ReadLine().ToCharArray();
            for (int i = 0; i < t; i++)
            {
                for (int j = 0; j < n-1; j++)
                {
                    if (c[j]=='B'&&c[j+1]=='G')
                    {
                        c[j] = 'G';
                        c[j + 1] = 'B';
                        j++;
                    }
                }
            }
            foreach (char item in c)
            {
                Console.Write(item);
            }

        }

    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace add
{
    class Program
    {
        static void Main(string[] args)
        {
            string s=Console.ReadLine();
            string str=Console.ReadLine();
            int n=int.Parse(s.Split(' ')[0]);
            int t=int.Parse(s.Split(' ')[1]);
                for(int j=0;j<t;j++)
                {
                    str=str.Replace("BG","GB");
                }
            Console.WriteLine(str);
        }
}
}

using System;

namespace _266B
{
    class Program
    {
        static void Main()
        {
            var input = Console.ReadLine().Split(' ');
            var count = int.Parse(input[0]);
            var times = int.Parse(input[1]);

            var queue = Console.ReadLine().ToCharArray();
            var switched = false;

            for (var i = 0; i < times; i++)
            {
                for (var j = 1; j < count; j++)
                {
                    if (switched)
                    {
                        switched = false;
                        continue;
                    }

                    if (!switched && queue[j] == 'G' && queue[j - 1] == 'B')
                    {
                        queue[j] = 'B';
                        queue[j - 1] = 'G';
                        switched = true;
                    }
                    else
                    {
                        switched = false;
                    }
                }

                switched = false;
            }

            Console.WriteLine(queue);
        }
    }
}

using System;
using System.Linq;

namespace _266B
{
    class Program
    {
        static void Main()
        {
                var t = Console.ReadLine().Split().Select(int.Parse).ToArray()[1];
                string queue = Console.ReadLine();
                for (int i = 1; i <= t; i++)
                {
                    queue = queue.Replace("BG", "GB");
                }
                Console.WriteLine(queue);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace W0lf
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int n = int.Parse(str[0]), t = int.Parse(str[1]);
            string s = Console.ReadLine();
            for(int i = 0; i < t; i++)
            {
                s = s.Replace("BG", "GB");
            }
            Console.WriteLine(s);
            Console.ReadLine();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Win32.SafeHandles;

namespace QueueAtSchool
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int n = input[0];
            int t = input[1];

            char[] kids = Console.ReadLine().ToArray();

            for (int i = 0; i < t; i++)
            {
                // Musim najit vsechny pripady kdy je kluk v rade pred holkou a prohodit je
                for (int j = 0; j < n - 1; j++)
                {
                    if (kids[j] == 'B' && kids[j + 1] == 'G')
                    {
                        var boy = kids[j];
                        kids[j] = kids[j + 1];
                        kids[j + 1] = boy;
                        j++;
                    }
                }
            }

            string result = new string(kids);
            Console.WriteLine(result);
            Console.ReadLine();
        }
    }
}

using System;

class Program
{
    static void Main()
    {
        var line = Console.ReadLine().Split();
        var n = int.Parse(line[0]);
        var t = int.Parse(line[1]);
        var s = Console.ReadLine().ToCharArray();

        for (int i = 0; i < t; i++)
        {
            for (int j = 0; j < n - 1; j++)
            {
                if (s[j] == 'B' && s[j + 1] == 'G')
                {
                    s[j] = 'G';
                    s[j + 1] = 'B';
                    j++;
                }
            }
        }
        Console.WriteLine(s);
    }
}

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using System.Linq;
using System.Text;

namespace CodeForces
{
    class Program
    {
        static void Main()
        {

            string input = Console.ReadLine();
            string queue = Console.ReadLine();
            for (int i = 0; i < Convert.ToInt32(input.Split(' ')[1]);  i++)
            {

                    queue = queue.Replace("BG", "GB");

            }
            Console.WriteLine(queue);
    }   }
}

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using System.Linq;
using System.Text;

namespace CodeForces
{
    class Program
    {
        static void Main()
        {

            string input = Console.ReadLine();
            char[] queue = Console.ReadLine().ToCharArray();
            for (int i = 0; i < Convert.ToInt32(input.Split(' ')[1]);  i++)
            {
                for (int j = 0; j < queue.Count()-1; j++)
                {
                    if (queue[j] == 'B' && queue[j+1] == 'G')
                    {
                        queue[j] = 'G';
                        queue[j + 1] = 'B';
                        j++;
                    }
                }
            }
            Console.WriteLine(string.Join("",queue));
    }   }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class Solution
    {

        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split();
            int x = int.Parse(input[0]);
            int t = int.Parse(input[1]);
            string s = Console.ReadLine();
            char[] newArr = s.ToCharArray();

            while (t != 0)
            {
                for (int i = 0; i < newArr.Length; i++)
                {
                    var temp = ' ';

                    if (!((i + 1) > newArr.Length - 1))
                    {
                        if (newArr[i] == 'B' && newArr[i + 1] == 'G')
                        {
                            temp = newArr[i];
                            newArr[i] = newArr[i + 1];
                            newArr[i + 1] = temp;
                            i += 1;
                        }
                    }
                }
                t--;
            }

            Console.WriteLine(new string(newArr));
        }
    }
}

using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Runtime.ExceptionServices;
using System.Runtime.InteropServices;
using System.Text;

namespace Codeforces
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ').Select(Int32.Parse).ToList();
            var queue = Console.ReadLine();

            var n = input[0];
            var k = input[1];

            for (var i = 0; i < k; i++)
            {
                var replace = new StringBuilder();

                for (var j = 0; j < n; j++)
                {
                    var a = queue[j];

                    if (a == 'B')
                    {
                        if (j < n - 1 && queue[j + 1] == 'G')
                        {
                            replace.Append($"{queue[j + 1]}{queue[j]}");
                            j++;
                            continue;
                        }
                    }

                    replace.Append($"{queue[j]}");
                }

                queue = replace.ToString();
            }

            Console.WriteLine(queue);
        }
    }
}

using System;
using System.Linq;
using System.Text;

namespace QueryInCitchen
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] array = Console.ReadLine().Split(' ')
                .Select(int.Parse).ToArray();
            StringBuilder query = new StringBuilder(Console.ReadLine());
            for (int i = 0; i < array[1]; i++)
            {
                for (int j = 0; j < query.Length; j++)
                {
                    try
                    {
                        if (query[j] == 'B' && query[j + 1] == 'G')
                        {
                            char tmp = query[j];
                            query[j] = query[j + 1];
                            query[j + 1] = tmp;
                            j++;
                        }
                    }
                    catch (IndexOutOfRangeException)
                    {
                        continue;
                    }
                }
            }
            Console.WriteLine(query);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;

namespace CodeForces
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ').Select((s) => int.Parse(s)).ToList();
            var n = input[0];
            var t = input[1];

            var queue = Console.ReadLine().ToArray();

            while (t-- > 0)
            {
                for (int i = 0; i < queue.Count() - 1; i++)
                {
                    var isBoy = queue[i] == 'B';
                    var isNextBoy = queue[i + 1] == 'B';

                    if (isBoy && !isNextBoy)
                    {
                        queue[i] = 'G';
                        queue[i + 1] = 'B';
                        i++;
                    }
                }
            }
            Console.WriteLine(new string(queue));
        }
    }
}

using System;
public class Program266B
    {
        public static string GetFinalPositions(int queuelength, int timeticks, string queue)
        {
            char[] students = queue.ToCharArray();

            for (int timetick = 0; timetick < timeticks; timetick++)
            {
                for (int s = 0; s < queuelength-1; s++)
                {
                    if (students[s] == 'B' && students[s + 1] == 'G')
                    {
                        students[s] = 'G';
                        students[s + 1] = 'B';
                        s++;
                    }
                }
            }

            return new String(students);
        }

        public static void Main()
        {
            try
            {
                string length_and_time = Console.ReadLine().Trim();
                int queuelength = int.Parse(length_and_time.Split(' ')[0]);
                int timeticks = int.Parse(length_and_time.Split(' ')[1]);

                string positions = Console.ReadLine().Trim();
                Console.WriteLine(GetFinalPositions(queuelength, timeticks, positions));
            }
            catch (Exception x)
            {
                Console.WriteLine(x);
            }
        }
}

using System;
using System.Linq;

namespace ConsoleApp5
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] data = Console.ReadLine().Split(' ');
            ushort n = Convert.ToUInt16(data[0]), t = Convert.ToUInt16(data[1]);
            string peopl = Console.ReadLine().ToUpper();
            bool flag = false;
            char[] peopls = peopl.ToArray();
            peopl = null;
            data = null;

            n -= 1;
            while (t!=0)
            {
                for (int i = 0; i < n ; i++)
                {
                    if (peopls[i] == 'B' && peopls[i + 1] == 'G' && !flag)
                    {
                        peopls[i] = 'G';
                        peopls[i + 1] = 'B';
                        flag = true;
                    }
                    else
                        flag = false;
                }
                t--;
                flag = false;
            }

            string res = new string(peopls);

            Console.WriteLine(res);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Mail;
using System.Text;
using System.Threading.Tasks;

namespace QueueAtTheSchool
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = Console.ReadLine();
            string[] strArr = str.Split(null);
            Int32.TryParse(strArr[1], out int k);
            string line = Console.ReadLine();
            char[] arr = line.ToCharArray();
            line = "";
            for (int i =0;i<k;i++)
            {
                for (int j = 0; j < arr.Length - 1; j++)
                {
                    if (arr[j] == 'B' && arr[j + 1] == 'G')
                    {
                        arr[j] = 'G';
                        arr[j + 1] = 'B';
                        j = j + 1;
                    }

                }

            }
            for (int i =0;i<arr.Length;i++)
            {
                line += arr[i];
            }
            Console.WriteLine(line);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class Program
    {
        static void swap<T>(ref T a, ref T b)
        {
            T c = a;
            a = b;
            b = c;
        }
        static void Main(string[] args)
        {
            string[] token = (Console.ReadLine()).Split();
            int t = Int32.Parse(token[1]);
            string str = Console.ReadLine();

            for (int k = 0; k < t; k++)
            {
                int i = 0;
                while (i < str.Length - 1)
                {
                    if ((str[i + 1] == 'G') & (str[i] == 'B'))
                    {
                        str = str.Remove(i, 1);
                        str = str.Insert(i + 1, "B");
                        i += 2;

                    }
                    else i++;
                }
            }
            System.Console.WriteLine(str);
            //System.Console.ReadKey();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace codeforces
{
    class Queue_at_the_School
    {
        static void Main(string[] args)
        {
            string a = Console.ReadLine();
            int n = int.Parse(a.Substring(0, a.IndexOf(' ')));
            int t = int.Parse(a.Substring(a.IndexOf(' ') + 1, a.Length - a.IndexOf(' ') - 1));
            string b = Console.ReadLine();
            string c = "";
            for (int j = 0; j < t; j++)
            {
                c = "";
                for (int i = 0; i < n; i++)
                {
                    if (b[i] == 'B')
                    {
                        if (i == b.Length - 1)
                        {
                            c += "B";
                            break;
                        }
                        if (b[i + 1] == 'G')
                        {
                            c += 'G';
                            i++;
                        }
                        c += 'B';
                    }
                    else
                    {
                        c += "G";
                    }
                }
                b = c;
            }
            Console.WriteLine(c);
            //Console.ReadKey();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Globalization;
namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s =Console.ReadLine().Split(' ');
            int chel = Convert.ToInt32(s[0]);
            int takt = Convert.ToInt32(s[1]);
            char boy = 'B';
            char temp=' ';
            string s1 = Console.ReadLine();
            char[] ar = new char[s1.Length];
            for (int i=0;i<chel;i++)
            ar[i]=Convert.ToChar(s1[i]);
            for (int i=0;i<takt;i++)
                for (int j=0;j<chel-1;j++)
                {
                    if (ar[j]==boy && ar[j+1]!=boy)
                    {
                        temp=ar[j];
                        ar[j]=ar[j+1];
                        ar[j+1]=temp;
                        j++;
                    }
                }
                for (int i=0;i<chel;i++)
                Console.Write(ar[i]);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _266B
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] InputNum = Console.ReadLine().Split();
            string Row = Console.ReadLine();
            int Number = int.Parse(InputNum[0]);
            int Time = int.Parse(InputNum[1]);
            int i = 0;
            int j = 0;
            char[] BG = Row.ToArray();
            char Help;
            while ( i < Time)
            {
                while( j < Number -1)
                {
                    if ( BG [j] == 'B' && BG [j+1]== 'G')
                    {
                        Help = BG[j];
                        BG[j] = BG[j + 1];
                        BG[j + 1] = Help;
                        j++;
                    }
                    j++;
                }

                j = 0;
                i++;

            }
            Console.WriteLine(BG);
        }
    }
}

using System;
using System.Linq;

namespace _266B_turn
{
    class Program
    {
        static void Main(string[] args)
        {
            var mass = Console.ReadLine()
                .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(x => int.Parse(x))
                .OrderBy(x => x)
                .ToArray();

            string str = Console.ReadLine();

            for (int i=0;i<mass[0]; i++)
            {
               str = str.Replace("BG","GB");
            }
            Console.WriteLine(str);
        }
    }
}

using System;
class Program
{
    static void Main()
    {
        int[] args = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        char[] s = Console.ReadLine().ToCharArray();
        for (int i = 0; i < args[1]; i++)
            for (int j = 0; j < s.Length-1; j++)
                if (s[j] == 'B' && s[j + 1] == 'G')
                {
                    s[j] = 'G';
                    s[j + 1] = 'B';
                    j++;
                }
        Console.WriteLine(s);
    }
}

using System;
using System.Collections.Generic;
using System.Linq;

namespace codeforces_console_app
{
    class Program
    {
        static void Main(string[] args)
        {
            //var nbRooms = Convert.ToInt32(Console.ReadLine());
            var input = Console.ReadLine().Split(' ').Select(s => Convert.ToInt32(s)).ToList();
            var seconds = input[1];
            var str = Console.ReadLine();
            var result = string.Empty;

            while (seconds > 0){
                result = string.Empty;
                for (int i = 0; i < str.Length; i++){
                    if (i + 1 < str.Length && str[i] == 'B' && str[i + 1] == 'G'){
                        result += "GB";
                        i++;
                        continue;
                    }

                    result += str[i];
                }

                str = result;
                seconds--;
            }

            //var coins = Console.ReadLine().Split(' ').Select(s => Convert.ToInt32(s)).ToList().OrderByDescending(s => s);*/

            Console.WriteLine(result);
            Console.ReadLine();
        }
    }
}

using System;
using System.Linq;

namespace CodeForcecTrain
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] input = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
            char[] kafka = Console.ReadLine().ToCharArray();
            int seconds = 0;
            while (seconds < input[1])
            {
                int i = 0;
                while (i < kafka.Length)
                {
                    if (i + 1 < kafka.Length && kafka[i] == 'B' && kafka[i + 1] == 'G')
                    {
                        kafka[i] = 'G';
                        kafka[i + 1] = 'B';
                        i++;
                    }
                    i++;
                }
                seconds++;
            }
            Console.Write(kafka);
        }
    }
}

using System;

namespace _4A
{
    class Program
    {
        static void Main(string[] args)
        {
            var str1 = Console.ReadLine().Split(' ');
            var str2 = Console.ReadLine().ToCharArray();
            var n = int.Parse(str1[0]);
            var t = int.Parse(str1[1]);

            for (int i = 0; i < t; i++)
            {
                for (int j = 0; j < n - 1; j++)
                {
                    var c1 = str2[j];
                    var c2 = str2[j+1];
                    if (c1 == 'B' && c2 == 'G')
                    {
                        str2[j] = 'G';
                        str2[j+1] = 'B';
                        j++;
                    }
                }
            }

            Console.WriteLine(new string(str2));
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace theater
{
    class CodeForces
    {
        static void Main(string[] args)
        {
            int[] UserInputs = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);

            char[] Students = Console.ReadLine().ToCharArray();

            for (int i = 1; i <= UserInputs[1]; i++)
            {
                for (int j = 0; j < Students.Length; j++)
                {
                    if (j != Students.Length - 1)
                    {
                        if (Students[j] != 'G')
                        {
                            if (Students[j + 1] == 'G')
                            {
                                char temp = Students[j];
                                Students[j] = Students[j + 1];
                                Students[j + 1] = temp;
                                j++;
                            }
                            else
                            {
                                continue;
                            }
                        }
                    }

                }

            }
            String st = new String(Students);
            Console.WriteLine(st);

        }

    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int n1 = Convert.ToInt32(input[0]);
            int n2 = Convert.ToInt32(input[1]);
            string queue = Console.ReadLine();
            StringBuilder sb = new StringBuilder();

            for (int i = 0; i < n2; i++)
            {
                for (int j = 0; j < queue.Length; j++)
                {
                    if (j < queue.Length - 1)
                    {
                        if (queue[j] == 'B' && queue[j + 1] == 'G')
                        {
                            sb.Append('G');
                            sb.Append('B');
                            j++;
                        }
                        else
                            sb.Append(queue[j]);
                    }
                    else
                        sb.Append(queue[j]);
                }
                queue = sb.ToString();
                sb.Clear();
            }

            Console.WriteLine(queue);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main()
    {
        List<int> input = ReadInputParseToList();
        List<char> c = new List<char>();
        int n = input[0];
        int time = input[1];
        string s = Console.ReadLine();

        for (int i = 0; i < s.Length; i++)
        {
            c.Add(s[i]);
        }

        for (int t = 0; t < time; t++)
        {
            for (int i = 0; i < n - 1; i++)
            {
                if (c[i] == 'B' && c[i + 1] == 'G')
                {
                    //var temp = c[i];
                    c[i] = 'G';
                    c[i + 1] = 'B';
                    i++;

                }
            }

        }
        Console.WriteLine(string.Join("", c));
        //Console.ReadKey();
    }
    private static List<int> ReadInputParseToList()
    {
        return Console.ReadLine().Split().Select(int.Parse).ToList();
    }
}

using System;
using System.Linq;

namespace SOLID
{
    class Program
    {
        public static void Main(String[] args)
        {
            string input = Console.ReadLine();
            string[] inputs = input.Split(" ");
            int queueLength = Int32.Parse(inputs[0]);
            int time = Int32.Parse(inputs[1]);

            char[] queue = Console.ReadLine().ToCharArray();

            for (int i = 0; i < time; i++)
            {
                for (int j = 0; j < queueLength; j++)
                {

                    if (j + 1 < queueLength)
                    {
                        if(queue[j] == 'B' && queue[j + 1] == 'G')
                    {
                            queue[j + 1] = 'B';
                            queue[j] = 'G';
                            j++;
                        }
                    }
                }
            }

            Console.WriteLine(new string(queue));

        }

    }
}

using System;
using System.Collections.Generic;
using System.Text;

namespace ohMy
{
    class QueueAtSchool
    {
        static void Main()
        {
            string[] input = Console.ReadLine().Split(" "); ;
            byte seconds;

            seconds = byte.Parse(input[1]);

            string currentLine = Console.ReadLine();

            for(byte i = 0; i< seconds; i++)
            {
                currentLine = currentLine.Replace("BG", "GB");
            }

            Console.WriteLine(currentLine);
        }

    }
}

using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        string reader = Console.ReadLine();
        int[] DataEntered = reader.Split(' ').Select(x => int.Parse(x)).ToArray();
        int n = DataEntered.First(); int t = DataEntered.Last();

        string Output = Console.ReadLine();
        for (int i = 1; i <= t; i++)
        {
            Output = Output.Replace("BG", "GB");
        }

        Console.WriteLine(Output);
    }

    public static void Swap (ref char a,ref char b)
    {
        char tmp = a; a = b; b = tmp;
    }
}

using System;
using System.Linq;

namespace QueueAtSchool
{
    class Program
    {
        static void Main(string[] args)
        {
            int num = Convert.ToInt32(Console.ReadLine().Split()[1]);
            Console.WriteLine(FinalQueue(Console.ReadLine(), num));
        }

        public static string FinalQueue(string initial)
        {
            char[] final = initial.ToCharArray();
            for (int i = 0; i < initial.Length-1; i++)
            {
                if (initial[i].Equals('B') && initial[i+1].Equals('G'))
                {
                    (final[i], final[i + 1]) = (final[i + 1], final[i]);
                    i += 1;
                }
            }
            return new string(final);
        }

        public static string FinalQueue(string initial, int timesteps)
        {
            string res = initial;
            for (int i = 0; i < timesteps; i++)
            {
                res = FinalQueue(res);
            }
            return res;
        }
    }
}

using System;

namespace codeforcespst
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ');
            char[] line = Console.ReadLine().ToCharArray();

            for (int i = 0; i < int.Parse(input[1]); i++)
            {
                for (int x = 0; x < int.Parse(input[0]) - 1; x++)
                {
                    if (line[x] == 'B' && line[x + 1] == 'G')
                    {
                        line[x] = 'G';
                        line[x + 1] = 'B';
                        x++;
                    }
                }
            }

            Console.WriteLine(line);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Numerics;

namespace dhsmfeh_zhelddmf_gkqslek
{
    public class Priority_Queue<T>
    {
        static List<int[]> priority_queue;

        public Priority_Queue()
        {
            priority_queue = new List<int[]>();
        }

        public void Push(int node, int weight)
        {
            int count = priority_queue.Count();
            int index = -1;

            if(count == 0)
            {
                priority_queue.Add(new int[] { node, weight });
                return;
            }
            for(int i = count; --i > -1;)
            {
                if(priority_queue[i][1] < weight)
                {
                    index = i + 1;
                    break;
                }
            }
            if (index.Equals(-1)) { index = 0; }
            priority_queue.Insert(index, new int[] { node, weight });
        }

        public int Pop()
        {
            int[] arr = priority_queue[0];
            priority_queue.RemoveAt(0);
            return arr[0];
        }

        public int count
        {
            get { return priority_queue.Count(); }
        }

    }
    class Program
    {
        static StringBuilder sb = new StringBuilder();
        static void Main(string[] args)
        {
            int[] init = Console.ReadLine().Split().Select(int.Parse).ToArray();

            string str = Console.ReadLine();

            for(int i =0; i<init[1]; i++)
            {
                str =str.Replace("BG", "GB");
            }
            Console.WriteLine(str);
        }
    }
}

using System;
using System.Linq;

namespace ProblemN
{
	public class Program
	{
		public static void Main(string[] args)
		{
			int t = int.Parse(Console.ReadLine().Trim().Split(' ')[1]);
			string s = Console.ReadLine().Trim();
			for(int i = 0; i < t; i++) s = s.Replace("BG", "GB");
			Console.WriteLine(s);
		}
	}
}

using System;

namespace CF_SchoolQueue {
    class Program {
        static void Main(string[] args) {
            string[] input = Console.ReadLine().Split();
            int time = Int32.Parse(input[1]);
            string queue = Console.ReadLine();
            for(int i = 0; i < time; ++i) {
                queue = queue.Replace("BG", "GB");
            }
            Console.WriteLine(queue);
        }
    }
}

using System;

namespace _266B
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int n = int.Parse(input[0]);
            int k = int.Parse(input[1]);
            char[] queue = Console.ReadLine().ToCharArray();
            for (int i = 0; i < k; i++)
            {
                for (int j = 0; j < n - 1; j++)
                {
                    if (queue[j] == 'B' && queue[j + 1] == 'G')
                    {
                        queue[j] = 'G';
                        queue[j + 1] = 'B';
                        j++;
                    }
                }
            }
            for (int i = 0; i < n; i++)
            {
                Console.Write(queue[i]);
            }
            Console.WriteLine();
        }
    }
}

using System;

class Program
{
	static void Main()
	{
		string[] inputNum = Console.ReadLine().Split();
		int lengthQue = int.Parse(inputNum[0]);
		int timeStep = int.Parse(inputNum[1]);

		string strQue = Console.ReadLine();
		char[] que = strQue.ToCharArray();

		for (int i = que.Length - 1; i >= 0; i--)
		{
			if (que[i] == 'B' || que[i] == 'b')
			{
				MoveToEnd(i, timeStep, que);
			}
		}

		strQue = new String(que);
		Console.WriteLine(strQue);
	}

	private static void MoveToEnd(int indexChar, int steps, char[] que)
	{
		for (int i = indexChar; (i < que.Length - 1 && steps-- > 0); i++)
		{
			if (que[i + 1] == 'B' || que[i + 1] == 'b')
			{
				break;
			}
			char temp = que[i + 1];
			que[i + 1] = que[i];
			que[i] = temp;
		}
	}
}

using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {

        int[] DATA = Enumerable.Select(Console.ReadLine().Split(' '), x => int.Parse(x)).ToArray();

        int n = DATA[0], t = DATA[1];
        List<char> Info = Console.ReadLine().ToCharArray().ToList();

        //5 2        BBGBBG  GBBGBB
        int FirstGirl = Info.IndexOf('G');

        while (FirstGirl != -1)
        {
            //BBGBGBGB  ==>   GGBGBBBB
            int Counter = 0;
            for (int i = FirstGirl-1; i >= 0; i--)
            {
                if (Info[i] != 'B' || Counter >= t) { break; } else Counter++;
            }
            Info[FirstGirl] = 'B';
            Info[(FirstGirl - Counter)] = '*';
            FirstGirl = Info.IndexOf('G');
        }
        Console.WriteLine(string.Join("",Info).Replace('*','G'));
    }

    private static IEnumerable<string> Permutate(string source)
    {
        if (source.Length == 1) return new List<string> { source };

        var permutations = from c in source
                           from p in Permutate(new String(source.Where(x => x != c).ToArray()))
                           select c + p;

        return permutations;
    }

}

//private static IEnumerable<string> Permutate(string source)
//{
//    if (source.Length == 1) return new List<string> { source };

//    var permutations = from c in source
//                       from p in Permutate(new String(source.Where(x => x != c).ToArray()))
//                       select c + p;

//    return permutations;
//}

using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {

        int[] DATA = Enumerable.Select(Console.ReadLine().Split(' '), x => int.Parse(x)).ToArray();

        int n = DATA[0], t = DATA[1];
        List<char> Info = Console.ReadLine().ToCharArray().ToList();

        //5 2
        //BGGBG        BGGBGBB
        //output
        //GGBGB
        int Swapped = 0;
        for (int w = 0; w < n; w++)
        {
            List<char> m = Info;
            for (int i = 1; i <= (t); i++)
            { //BGG
                //if (Info[w] == 'B')
                {
                    if (w+i < n)
                    {
                        if (Info[w + i] == Info[w + i - 1]) continue;
                        if (Info[w + i] == 'G') { m[w + i] = 'B'; Swapped++; }
                        if (Info[w + i - 1] == 'B') { m[w + i - 1] = 'G'; }
                    }
                }
            }
            // 0 3
            Info = m;

            if (Swapped > 0) w += t;
            Swapped = 0;
        }

        Console.WriteLine(string.Join("",Info));
    }

    private static IEnumerable<string> Permutate(string source)
    {
        if (source.Length == 1) return new List<string> { source };

        var permutations = from c in source
                           from p in Permutate(new String(source.Where(x => x != c).ToArray()))
                           select c + p;

        return permutations;
    }

}

//private static IEnumerable<string> Permutate(string source)
//{
//    if (source.Length == 1) return new List<string> { source };

//    var permutations = from c in source
//                       from p in Permutate(new String(source.Where(x => x != c).ToArray()))
//                       select c + p;

//    return permutations;
//}

using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var InData = Console.ReadLine().Split(' ').Select(x => int.Parse(x));
        int n = InData.First(), t = InData.Last();

        string[] Input = Console.ReadLine().Select(x => x.ToString()).ToArray();
        int Bindex = Input.ToList().IndexOf("B");
        int currentIndex = Bindex;
        while (Bindex != -1)
        {
            int u = 0;

            for (int i = Bindex + 1; i < Input.Length; i++)
            {
                if (u >= t) break;
                if (Input[i] == "G")
                {
                    Swap(ref Input[currentIndex], ref Input[i]);
                    currentIndex = i;
                }
                if (Input[i] != "F")u++;
            }
            Input[currentIndex] = "F";
            Bindex = Input.ToList().IndexOf("B");
            currentIndex = Bindex;
        }

        Console.WriteLine(string.Join("", Input).Replace("F", "B"));
    }

    static void Swap(ref string O, ref string N)
    {
        string tmp = O; O = N; N = tmp;
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Win32.SafeHandles;

namespace QueueAtSchool
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int n = input[0];
            int t = input[1];

            char[] kids = Console.ReadLine().ToArray();

            for (int i = 0; i < t; i++)
            {
                // Musim najit vsechny pripady kdy je kluk v rade pred holkou a prohodit je
                for (int j = 0; j < n; j++)
                {
                    if(j + 1 >= n)
                        break;

                    char boy = kids[j];

                    if (boy == 'B')
                    {
                        char girl = kids[j + 1];

                        if (girl == 'G')
                        {
                            kids[j] = girl;
                            kids[j + 1] = boy;
                            j += 2;
                        }
                    }
                }
            }

            string result = new string(kids);
            Console.WriteLine(result);
            Console.ReadLine();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Queue_at_the_School
{
    class Program
    {
        static void Main(string[] args)
        {
            int sumB =0;
            string line = Console.ReadLine();
            string line1 = Console.ReadLine();
            int n = Convert.ToInt16(line.Substring(0, line.IndexOf(' ')));
            int x = Convert.ToInt16(line.Substring(line.IndexOf(' ')+1));
            int counter = 0;
            int counter1 = 0;
            for (int i = 0; i < line1.Length; i++)
            {
                if (line1[i] == 'B')
                {
                    sumB++;
                }
            }
            int[] posB = new int[sumB];
            int[] numG = new int[sumB];
            for (int i = 0; i < line1.Length; i++)
            {
                if (line1[i] == 'B')
                {
                    posB[counter] = i;
                    counter++;
                }
            }
            counter = 0;
            for (int i = line1.IndexOf('B')+1; i < line1.Length; i++)
            {
                if (line1[i] == 'B')
                {
                    numG[counter] = counter1;
                    counter++;
                    counter1 = 0;
                }
                else counter1++;
                if (i == line1.Length - 1)
                {
                    numG[counter] = counter1;
                    break;
                }
            }
            int v = 0;
                    for (int j = numG.Length - 1; j >= 0; j--)
                    {
                        if (numG[j] != 0)
                        {
                            if (x>numG[j])
                            {
                                line1 = line1.Remove(posB[j], 1);
                                line1 = line1.Insert(posB[j] + 1, "B");
                                if (j == 0) break;
                                numG[j - 1] = numG[j - 1] + numG[j];
                            }
                            if (x<numG[j])
                            {
                                line1 = line1.Remove(posB[j], 1);
                                line1 = line1.Insert(x, "B");
                                if (j == 0) break;
                                numG[j - 1] = numG[j - 1] + numG[j];
                            }

                        }
                    }
            Console.WriteLine(line1);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var _reader = Console.ReadLine().Split(' ').Select(x => int.Parse(x.ToString()));
        int n = _reader.First(), t = _reader.Last();
        List<string> Output = Console.ReadLine().Select(x => x.ToString()).ToList();

        int IndexofB = Output.IndexOf("B");

        while (IndexofB > -1)
        {
            string[] Modify = Output.Skip(IndexofB).Take(t + 1)/*.OrderByDescending(x => Convert.ToChar(x))*/.ToArray();
            int Lindex = Modify.ToList().IndexOf("B");
            int u = 0;//BBGBGBGB
            for (int i = Lindex; i < Modify.Length; i++)
            {
                if (Modify[i] == "G")
                {
                    Swap(ref Modify[i], ref Modify[Lindex]);
                    Lindex = i;
                }
            }

            Modify[Lindex] = "*";

            for (int i = IndexofB; i < Output.Count; i++)
            {
                Output[i] = Modify[u];
                u++;
                if (u == (Lindex+1)) break;
            }

            IndexofB = Output.IndexOf("B");
        }
        Console.WriteLine(string.Join("", Output).Replace("*", "B"));
    }
    static void Swap(ref string p , ref string i)
    {
        string t = p; p = i; i = t;
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Queue_at_the_School
{
    class Program
    {
        static void Main(string[] args)
        {
            int sumB =0;
            string line = Console.ReadLine();
            string line1 = Console.ReadLine();
            int n = Convert.ToInt16(line.Substring(0, line.IndexOf(' ')));
            int x = Convert.ToInt16(line.Substring(line.IndexOf(' ')+1));
            int counter = 0;
            int counter1 = 0;
            for (int i = 0; i < line1.Length; i++)
            {
                if (line1[i] == 'B')
                {
                    sumB++;
                }
            }
            int[] posB = new int[sumB];
            int[] numG = new int[sumB];
            for (int i = 0; i < line1.Length; i++)
            {
                if (line1[i] == 'B')
                {
                    posB[counter] = i;
                    counter++;
                }
            }
            counter = 0;
            for (int i = line1.IndexOf('B')+1; i < line1.Length; i++)
            {
                if (line1[i] == 'B')
                {
                    numG[counter] = counter1;
                    counter++;
                    counter1 = 0;
                }
                else counter1++;
                if (i == line1.Length - 1)
                {
                    numG[counter] = counter1;
                    break;
                }
            }
            for (int i = 0; i < sumB; i++)
            {
                if(x<=numG[i])
                {
                    line1=line1.Remove(posB[i], 1);
                    line1=line1.Insert(posB[i] +x, "B");
                }
                else if(x>numG[i])
                {
                    line1 = line1.Remove(posB[i], 1);
                    line1 = line1.Insert(posB[i] + numG[i], "B");
                }
            }
            Console.WriteLine(line1);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace codeforces
{
    class Queue_at_the_School
    {
        static void Main(string[] args)
        {
            string a = Console.ReadLine();
            int n = int.Parse(a.Substring(0, a.IndexOf(' ')));
            int t = int.Parse(a.Substring(a.IndexOf(' ') + 1, a.Length - a.IndexOf(' ') - 1));
            string b = Console.ReadLine();
            string c = "";
            for(int i = 0; i < n; i++)
            {
                if(b[i] == 'B')
                {
                    if (i == b.Length - 1)
                    {
                        c += "B";
                        break;
                    }
                    for(int j = i + 1; j <= i + t; j++)
                    {
                        if(j == b.Length - 1)
                        {
                            if (b[j] == 'G')
                            {
                                c += "G";
                            }
                            break;
                        }
                        if (b[j] == 'G')
                        {
                            c += "G";
                        }
                    }
                    c += "B";
                    i += t;
                }
                else
                {
                    c += b[i];
                }
            }
            Console.WriteLine(c);
            //Console.ReadKey();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ACM
{
    class Program
    {
        static void Main(string[] args)
        {
            //while (true)
            {
                #region A. Boy or Girl
                ///*

                // wjmzbmr

                // */
                //int Notdistinct = 0;

                //string Name = Console.ReadLine();
                //for (int i = 0; i < Name.Length; i++)
                //{
                //    //Console.WriteLine(i);
                //    for (int j = i+1; j < Name.Length; j++)
                //    {
                //        //Console.WriteLine(j);
                //        //Console.WriteLine(Name[i] + "===" + Name[j]);
                //        if (Name[i]==Name[j])
                //        {
                //            Notdistinct++;
                //            //Console.WriteLine(Notdistinct);

                //        }

                //    }

                //}
                ////Console.WriteLine( Name.Length +"-"+Notdistinct+"=" +(Name.Length - Notdistinct) );

                ////Console.WriteLine("Result%2="+(Name.Length - Notdistinct) % 2);

                //if ((Name.Length-Notdistinct)%2==0)
                //{
                //    if ((Name.Length - Notdistinct)<0)
                //    {
                //        Console.WriteLine("IGNORE HIM!");
                //    }
                //    else
                //    {
                //        Console.WriteLine("CHAT WITH HER!");
                //    }

                //}
                //else
                //{

                //    Console.WriteLine("IGNORE HIM!");

                //}

                #endregion

                #region Queue at the School
                string[] tokens = Console.ReadLine().Split();

                int n = int.Parse(tokens[0]);
                int t1 = 0;
                 int t = int.Parse(tokens[1]);
                char []  Temp =new char[50] ;
                string x="";

                string Quee = Console.ReadLine();
                for (int i = 0; i < n; i++)
                {
                    Temp[i] = Quee[i];

                }

                //while (true)
                //{
                //    try
                //    {
                //        if (Temp[t1] == Convert.ToChar("B"))
                //        {
                //            if (Temp[t1 + 1] == Convert.ToChar("G"))
                //            {
                //                Temp[t1] = Convert.ToChar("G");
                //                Temp[t1 + 1] = Convert.ToChar("B");
                //                t1++;
                //            }

                //        }
                //        t1++;
                //        if (t1 >= Quee.Length)
                //        {
                //            break;
                //        }
                //    }
                //    catch (Exception)
                //    {

                //        throw;
                //    }

                // }
                for (int ij = 0; ij < t; ij++)
                {
           for (int i = 0; i < n; i++)
            {
                if (Temp[i] == Convert.ToChar("B"))
                {
                    if (Temp[i + 1] == Convert.ToChar("G"))
                    {
                        Temp[i] = Convert.ToChar("G");
                        Temp[i + 1] = Convert.ToChar("B");
                        i++;
                    }
                }

            }
                }

            Console.WriteLine(Temp );

                #endregion

              //  Console.ReadKey();
            }

        }

    }
}

using System;

namespace Очередь_в_школе
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] nt = Console.ReadLine().Split();
            int n = Convert.ToInt32(nt[0]);
            int t = Convert.ToInt32(nt[1]) + 1;
            string lineString = Console.ReadLine();
            char[] lineMas = new char[n];
            for (int i = 0; i < lineString.Length; i++)
            {
                lineMas[i] = Convert.ToChar(lineString[i]);
            }
            int count = 0;
            for (int i = 0; i < n - 1; i++)
            {

                if (lineMas[i] == 'B' && lineMas[i + 1] == 'G' && count < t)
                {
                    lineMas[i] = 'G';
                    lineMas[i + 1] = 'B';
                    count++;
                }
                if (count == t)
                {
                    break;
                }
            }
            for (int i = 0; i < lineMas.Length; i++)
            {
                Console.Write(lineMas[i]);
            }
        }
    }
}

using System;

class Program
{
	static void Main()
	{
		string[] inputNum = Console.ReadLine().Split();
		int lengthQue = int.Parse(inputNum[0]);
		int timeStep = int.Parse(inputNum[1]);

		string strQue = Console.ReadLine().Trim();
		char[] que = strQue.ToCharArray();

		for (int i = que.Length - 1; i >= 0; i--)
		{
			if (que[i] == 'B' || que[i] == 'b')
			{
				MoveToEnd(i, timeStep, que);
			}
		}

		strQue = new String(que);
		Console.WriteLine(strQue);

		Console.ReadLine();
	}

	private static void MoveToEnd(int indexChar, int steps, char[] que)
	{
		for (int i = indexChar; (i < que.Length - 1 && steps-- > 0); i++)
		{
			if (que[i + 1] == 'B' || que[i + 1] == 'b')
			{
				break;
			}
			char temp = que[i + 1];
			que[i + 1] = que[i];
			que[i] = temp;
		}
	}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Queue_at_the_School
{
    class Program
    {
        static void Main(string[] args)
        {
            int sumB =0;
            string line = Console.ReadLine();
            string line1 = Console.ReadLine();
            int n = Convert.ToInt16(line.Substring(0, line.IndexOf(' ')));
            int x = Convert.ToInt16(line.Substring(line.IndexOf(' ')+1));
            int counter = 0;
            int counter1 = 0;
            for (int i = 0; i < line1.Length; i++)
            {
                if (line1[i] == 'B')
                {
                    sumB++;
                }
            }
            int[] posB = new int[sumB];
            int[] numG = new int[sumB];
            for (int i = 0; i < line1.Length; i++)
            {
                if (line1[i] == 'B')
                {
                    posB[counter] = i;
                    counter++;
                }
            }
            counter = 0;
            for (int i = line1.IndexOf('B')+1; i < line1.Length; i++)
            {
                if (line1[i] == 'B')
                {
                    numG[counter] = counter1;
                    counter++;
                    counter1 = 0;
                }
                else counter1++;
                if (i == line1.Length - 1)
                {
                    numG[counter] = counter1;
                    break;
                }
            }
            int v = 0;
                    for (int j = numG.Length - 1; j >= 0; j--)
                    {
                        if (numG[j] != 0)
                        {
                            line1 = line1.Remove(posB[j], 1);
                            line1 = line1.Insert(posB[j] + 1, "B");
                            if (j == 0) break;
                            numG[j - 1] = numG[j - 1] + numG[j];
                        }
                    }
            Console.WriteLine(line1);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace codeforces
{
    class Queue_at_the_School
    {
        static void Main(string[] args)
        {
            string a = Console.ReadLine();
            int n = int.Parse(a.Substring(0, a.IndexOf(' ')));
            int t = int.Parse(a.Substring(a.IndexOf(' ') + 1, a.Length - a.IndexOf(' ') - 1));
            int help = t;
            string b = Console.ReadLine(), c = "";
            for (int i = 0; i < n; i++)
            {
                help = t;
                if (b[i] == 'B')
                {
                    while (help != 0)
                    {
                        if (i == b.Length - 1)
                        {
                            break;
                        }
                        if (b[i + 1] == 'G')
                        {
                            c += "G";
                            i++;
                            help--;
                        }
                        else if(b[i+1]=='B')
                        {
                            break;
                        }
                    }
                    c += "B";
                }
                else
                {
                    c += "G";
                }
            }
            Console.WriteLine(c);
            //Console.ReadKey();
        }
    }
}

using System;
using System.Linq;
using System.Text;

namespace _266B
{
    class Program
    {
        static void Main()
        {
                var t = Console.ReadLine().Split().Select(int.Parse).ToArray()[1];
                string queue = Console.ReadLine();
                for (int i = 1; i <= t; i++)
                {
                    queue.Replace("BG", "GB");
                }
                Console.WriteLine(queue);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Text;

namespace ACM
{
	class Program
	{
		static void Main(string[] args)
		{
			string[] s = Console.ReadLine().Split(new char[]{' '}, StringSplitOptions.RemoveEmptyEntries);
			int n = int.Parse(s[0]);
			int k = int.Parse(s[1]);

			string r = Console.ReadLine();
			List<int> boys = new List<int>();
			for (int i = 0; i < n; i++)
				if (r[i] == 'B')
					boys.Add(i);

			int q = Math.Max(boys[boys.Count - 1], n - 1);
			for (int j = 0; j < k; j++)
				for (int i = 0; i < boys.Count; i++)
					if (boys[i] < q)
						boys[i]++;

			r = "";
			for (int i = 0; i < n; i++)
				if (boys.Contains(i))
					r += 'B';
				else
					r += 'G';
			Console.WriteLine(r);

			//Console.ReadKey();
		}
	}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace code
{
    class Wight
    {

        static void Main(string[] args)
        {

            string[] lines = new string[2];

            for(int i=0; i<lines.Length;i++)
            {
                lines[i]= Console.ReadLine();
            }

           string[] counts = lines[0].Split(' ');

            int count = Convert.ToInt16(counts[0]);

         char[]queue=   lines[1].ToCharArray();

            for(int j=count-1;j>=0;j--)
            {
                Console.Write(queue[j]);
            }

            Console.WriteLine();

        }
    }
}

using System;

namespace QueueTask
{
    class Program
    {
        static void Main(string[] args)
        {

            string[] StartValue = Console.ReadLine().Split(' ');
            int CountOfHumans = int.Parse(StartValue[0]);
            int HowMaNyTimes = int.Parse(StartValue[1]);
            string Children = Console.ReadLine();
            char[] chs = new char[Children.Length];
            for(int i = 0; i < Children.Length;i++)
            {
                chs[i] = Children[i];
            }

            int count = 0;
            bool[] YesOrNo = new bool[chs.Length];
            while (count < HowMaNyTimes)
            {
                for(int i = 0; i < chs.Length; i++)
                {
                    if (i + 1 < chs.Length)
                    {
                        if (chs[i] == 'B' && chs[i + 1] == 'G' && !YesOrNo[i])
                        {
                            char tmp = chs[i];
                            chs[i] = chs[i + 1];
                            chs[i + 1] = tmp;
                            YesOrNo[i + 1] = true;
                        }
                    }
                }
                count++;
                YesOrNo = new bool[chs.Length];

                foreach (char c in chs)
                    Console.Write(c);
                Console.WriteLine();
            }
        }
    }
}

using System;

class Program
{
	static void Main()
	{
		try
		{
			string[] inputNum = Console.ReadLine().Split();
			int lengthQue = int.Parse(inputNum[0]);
			int timeStep = int.Parse(inputNum[1]);

			char[] que = Console.ReadLine().ToCharArray();

			for(int i = que.Length - 1; i >= 0; i--)
			{
				if(que[i] == 'B')
				{
					MoveToEnd(i, timeStep, que);
				}
			}
			Console.WriteLine(new String(que));
		}
		catch(Exception ex)
		{
			Console.WriteLine(ex.Message);
		}

		Console.ReadLine();
	}

	private static void MoveToEnd(int indexChar, int steps, char[] que)
	{
		for(int i = indexChar; (i < que.Length - 1 && steps-- > 0); i++)
		{
			if(que[i+1] == 'B')
			{
				break;
			}

			char temp = que[i+1];
			que[i+1] = que[i];
			que[i] = temp;
		}
	}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication22
{
    class Program
    {
        static void Main(string[] args)
        {
            var l = Console.ReadLine().Split(' ').Select(x => int.Parse(x));
            int n = l.First(), t = l.Last();
            List<char> Input = Console.ReadLine().Select(x => x).ToList();

            int IndexOF = Input.IndexOf('B');

            while (IndexOF > -1)
            {
                char[] xD = Input.Skip(IndexOF).Take(t + 1).ToArray();

                int index = 0;

                for (int i = 1; i < xD.Length; i++)
                {
                    if (xD[i] == '*') continue;
                   // if (xD[i] == 'G')
                   // {
                        Swap(ref xD[i], ref xD[index]);
                        index = i;
                    //}
                }

                xD[index] = '*';
                int u = 0;
                for (int i = IndexOF; i < Input.Count; i++)
                {
                    if (u == xD.Length) break;
                    Input[i] = xD[u];
                    u++;
                }

                IndexOF = Input.IndexOf('B');
            }

            Console.WriteLine(string.Join("", Input).Replace('*','B'));

        }

        static void Swap(ref char O, ref char N)
        {
            char tmp = O;  O = N; N = tmp;
        }

        private static IEnumerable<string> Perms(string source)
        {
            if (source.Length == 1) return new List<string>() { source };

            var perm = from l in source
                       from _x in Perms(string.Join("", source.Where(x => x != l)))
                       select l + _x; ;
            return perm;
        }
    }
}

using System;
using System.Text;
class test{
    public static void Main(string[] temp){
        int[] NK=Array.ConvertAll(Console.ReadLine().Split(' '),Int32.Parse);
        StringBuilder queue=new StringBuilder(Console.ReadLine());
        for(int i=0;i<NK[1];i++){
            for(int j=1;j<NK[0];j++){
                if(queue[j]=='G'&&queue[j-1]=='B'){
                    queue[j-1]='G';
                    queue[j]='B';

            } if(j+1<NK[0]&&queue[j+1]=='G')
                    i++;
                    }

        } Console.WriteLine(queue.ToString());
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace code
{
    class Wight
    {

        static void Main(string[] args)
        {

            string[] lines = new string[2];

            for(int i=0; i<lines.Length;i++)
            {
                lines[i]= Console.ReadLine();
            }

           string[] counts = lines[0].Split(' ');

            int count = Convert.ToInt16(counts[0]);

            int index= Convert.ToInt16(counts[1]);

            char[]queue=   lines[1].ToCharArray();

            char[] newqueu= new char[count];

            for(int j=count-1;j>=0;j--)
            {

                newqueu[count-1-j] = queue[j];

                if(count%2!=0)
                {
                    Console.Write(queue[j]);
                }

            }

            if (count % 2 == 0)
            {
                for (int m = index; m < count; m++)
                {
                    Console.Write(newqueu[m]);
                }

                for (int f = 0; f < index; f++)
                {
                    Console.Write(newqueu[f]);
                }
            }

            Console.WriteLine();

        }
    }
}

using System;
using System.Linq;

class Problem
{
    public static void Main()
    {
        int[] nt = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        int n = nt[0];
        int t = nt[1];

        char[] children = Console.ReadLine().ToCharArray();

        for (int i = 0; i < t; i++)
        {
            for (int j = n - 1; j > 0; j--)
            {
                if (children[j] - children[j - 1] > 0)
                {
                    char temp = children[j];
                    children[j] = children[j - 1];
                    children[j - 1] = temp;
                }
            }
        }

        Console.WriteLine(string.Join(string.Empty, children));
    }

    private static bool IsLucky(int n)
    {
        return n.ToString().All(c => c == '4' || c == '7');
    }
}

#define ASD
#if (Debug)
#define Trace
#endif
#if (ASD)
using DS.Common;
using DS.Dictionaries;
using DS.Graphs;
using DS.Heaps;
using DS.Lists;
using DS.Trees;
using DS;
using AL;
using AL.Common;
using AL.Graphs;
using AL.Numeric;
using AL.Sorting;
#endif
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using GenericArithmetic;
using System.Reflection;
using System.Windows;
using System.Text.RegularExpressions;
using csConsoleforStudy;
using System.Resources;
using System.Runtime.Serialization;

namespace csConsoleforStudy
{
 class Program
 {
  const double MemoryLimit = 2.56;
  const double TimeLimit = 4000;
  static Stream fsr;
  static FileStream fsw;
  static TextReader tr;
  static TextWriter tw;
  static Thread t;
  static Thread mainThread = Thread.CurrentThread;
  static Stopwatch sw = new Stopwatch();
  static DefaultTraceListener Logger;
  static long maxUsedMemory = 0;
  static void Main(string[] args)
  {
   OpenStream();
   Solver s = new Solver();
   s.Solve();
   CloseStream();
  }

  static void OpenStream()
  {
#if (Debug)
#endif
  }

  static void CloseStream()
  {
#if (Debug)
#endif
  }

  static void CheckMemory()
  {
#if (Debug)
#endif
  }
 }

 class Solver
 {
  public void Solve()
  {
   var l1 = ria();
   var n = l1[0];
   var t = l1[1];
   var l2 = Console.ReadLine();
   char[] State = l2.ToCharArray();
   for (int round = 0; round < t; round++)
   {
    for (int i = n - 1; i >= 0; i--)
    {
     if (i == n - 1)
     {
     }
     else if (i == 0)
     {
      if (State[i + 1] == 'G' && State[i] == 'B')
      {
       swap(State, i, i + 1);
      }
     }
     else
     {
      if (State[i + 1] == 'G' && State[i] == 'B')
      {
       swap(State, i, i + 1);
      }
     }
    }
   }

   Console.WriteLine(State);
  }

  public char[] swap(char[] str, int a, int b)
  {
   Tuple<char, char> chars = new Tuple<char, char>(str[a], str[b]);
   str[a] = chars.Item2;
   str[b] = chars.Item1;
   return str;
  }

#region SolverUtils
  private const double AbsoluteError = 1e-10;
  private const double RelativeError = 1e-8;
  private static int NextInt()
  {
   int c;
   int res = 0;
   do
   {
    c = Console.Read();
    if (c == -1)
     return res;
   }
   while (c < '0' || c > '9');
   res = c - '0';
   while (true)
   {
    c = Console.Read();
    if (c < '0' || c > '9')
     return res;
    res *= 10;
    res += c - '0';
   }
  }

  static string rs()
  {
   return Console.ReadLine();
  }

  static int ri()
  {
   return int.Parse(Console.ReadLine());
  }

  static long rl()
  {
   return long.Parse(Console.ReadLine());
  }

  static double rd()
  {
   return double.Parse(Console.ReadLine());
  }

  static string[] rsa()
  {
   return Console.ReadLine().Split(' ');
  }

  static int[] ria()
  {
   return Array.ConvertAll(Console.ReadLine().Split(' '), e => int.Parse(e));
  }

  static long[] rla()
  {
   return Array.ConvertAll(Console.ReadLine().Split(' '), e => long.Parse(e));
  }

  static double[] rda()
  {
   return Array.ConvertAll(Console.ReadLine().Split(' '), e => double.Parse(e));
  }

  static void ReadLineAndAssign(string type, params object[] p)
  {
   dynamic input;
   if (type.StartsWith("i"))
    input = ria();
   else if (type.StartsWith("l"))
    input = rla();
   else if (type.StartsWith("d"))
    input = rda();
   else
    throw new AE("no match " + type.ToString());
   for (int i = 0; i < p.Length; i++)
   {
    p[i] = input[i];
   }
  }

  static void SwapIfGreater<T>(ref T lhs, ref T rhs)where T : IComparable<T>
  {
   T temp;
   if (lhs.CompareTo(rhs) > 0)
   {
    temp = lhs;
    lhs = rhs;
    rhs = temp;
   }
  }

  static bool DoubleEqual(double a, double b)
  {
   double diff = Math.Abs(a - b);
   if (diff < AbsoluteError)
    return true;
   return diff <= RelativeError * Math.Max(Math.Abs(a), Math.Abs(b));
  }

  static dynamic abs(dynamic num)
  {
   return Math.Abs(num);
  }

  static dynamic max(dynamic a, dynamic b)
  {
   return Math.Max(a, b);
  }
 }

 static class MyExtensions
 {
  public static string Reverse(this string str)
  {
   StringBuilder sb = new StringBuilder(str.Length);
   for (int i = str.Length - 1; i >= 0; i--)
   {
    sb.Append(str[i]);
   }

   return sb.ToString();
  }
 }

#endregion
 struct Pair
 {
  public long X, Y;
  public Pair(long x, long y)
  {
   X = x;
   Y = y;
  }
 }

 struct Bit
 {
  bool state;
  public Bit(bool state)
  {
   this.state = state;
  }

  public override int GetHashCode()
  {
   return base.GetHashCode();
  }

  public override string ToString()
  {
   return state.ToString();
  }

  public override bool Equals(object other)
  {
   if (other is Bit)
   {
    return state == ((Bit)other).state;
   }
   else
   {
    if ((int)other == 1 && state == true)
     return true;
    else if ((int)other == 0 && state == false)
     return true;
    else
     return base.Equals(other);
   }
  }

  public static implicit operator bool (Bit a)
  {
   return a.state;
  }

  public static implicit operator Bit(bool a)
  {
   return new Bit(a);
  }

  public static implicit operator Bit(int a)
  {
   if (a == 0)
    return new Bit(false);
   return new Bit(true);
  }

  public static bool operator ==(Bit a, Bit b)
  {
   return a.state == b.state;
  }

  public static bool operator !=(Bit a, Bit b)
  {
   return a.state != b.state;
  }

  public static Bit operator !(Bit a)
  {
   return new Bit(!a.state);
  }

  public static Bit operator +(Bit a, Bit b)
  {
   return new Bit(a.state || b.state);
  }

  public static Bit operator *(Bit a, Bit b)
  {
   return new Bit(a.state && b.state);
  }

  public static Bit operator ^(Bit a, Bit b)
  {
   return new Bit(a.state ^ b.state);
  }
 }

#if (MS)
#endif
#region Exceptions
 [Serializable]
 internal class IOE : InvalidOperationException
 {
  public IOE()
  {
  }

  public IOE(string message): base (message)
  {
  }

  public IOE(string message, Exception innerException): base (message, innerException)
  {
  }

  protected IOE(SerializationInfo info, StreamingContext context): base (info, context)
  {
  }
 }

 [Serializable]
 internal class AE : ArgumentException
 {
  public AE()
  {
  }

  public AE(string message): base (message)
  {
  }

  public AE(string message, Exception innerException): base (message, innerException)
  {
  }

  protected AE(SerializationInfo info, StreamingContext context): base (info, context)
  {
  }
 }
#endregion
}

namespace GenericArithmetic
{
 public class Vector<T>
 {
  public static readonly ICalculator<T> Calculator = Number<T>.Calculator;
  public T X
  {
   get;
   set;
  }

  public T Y
  {
   get;
   set;
  }

  public Vector(T x, T y)
  {
   X = x;
   Y = y;
  }

  public override bool Equals(object obj)
  {
   return base.Equals(obj);
  }

  public override int GetHashCode()
  {
   return base.GetHashCode();
  }

  public static bool operator ==(Vector<T> a, Vector<T> b)
  {
   return EqualityComparer<T>.Default.Equals(a.X, b.X) && EqualityComparer<T>.Default.Equals(a.Y, b.Y);
  }

  public static bool operator !=(Vector<T> a, Vector<T> b)
  {
   return !(EqualityComparer<T>.Default.Equals(a.X, b.X) && EqualityComparer<T>.Default.Equals(a.Y, b.Y));
  }

  public static Vector<T> operator !(Vector<T> a)
  {
   return new Vector<T>(Calculator.Difference(new Number<T>(default (T)), a.X), Calculator.Difference(new Number<T>(default (T)), a.Y));
  }

  public static Vector<T> operator +(Vector<T> a, Vector<T> b)
  {
   return new Vector<T>(Calculator.Sum(a.X, b.X), Calculator.Sum(a.Y, b.Y));
  }

  public static Vector<T> operator -(Vector<T> a, Vector<T> b)
  {
   return new Vector<T>(Calculator.Difference(a.X, b.X), Calculator.Difference(a.Y, b.Y));
  }
 }

 public class Matrix<T>
 {
  public static readonly ICalculator<T> Calculator = Number<T>.Calculator;
  public int W
  {
   get;
   set;
  }

  public int H
  {
   get;
   set;
  }

  public int rows
  {
   get
   {
    return H;
   }

   set
   {
    H = value;
   }
  }

  public int cols
  {
   get
   {
    return W;
   }

   set
   {
    W = value;
   }
  }

  public T[, ] Map
  {
   get;
   set;
  }

  public T this[int x, int y]
  {
   get
   {
    return Map[x, y];
   }

   set
   {
    Map[x, y] = value;
   }
  }

  public Matrix(T[, ] map)
  {
   Map = map;
   W = map.GetLength(0);
   H = map.GetLength(1);
  }

  public Matrix(int w, int h, T defaultValue = default (T))
  {
   W = w;
   H = h;
   Map = new T[W, H];
#if (ASD)
   Map.Populate(W, H, defaultValue);
#endif
  }

  public override bool Equals(object obj)
  {
   if (obj is Matrix<T>)
   {
    return this == (Matrix<T>)obj;
   }

   return base.Equals(obj);
  }

  public override int GetHashCode()
  {
   return base.GetHashCode();
  }

  public static bool operator ==(Matrix<T> a, Matrix<T> b)
  {
   bool ret = true;
   if (a.Map != b.Map)
    ret = false;
   else if (a.W != b.W)
    ret = false;
   else if (a.H != b.H)
    ret = false;
   return ret;
  }

  public static bool operator !=(Matrix<T> a, Matrix<T> b)
  {
   bool ret = true;
   if (a.Map != b.Map)
    ret = false;
   else if (a.W != b.W)
    ret = false;
   else if (a.H != b.H)
    ret = false;
   return !ret;
  }

  public static Matrix<T> operator +(Matrix<T> a, Matrix<T> b)
  {
   if (a.W != b.W)
    return null;
   else if (a.H != b.H)
    return null;
   else
   {
    Matrix<T> ret = new Matrix<T>(a.W, a.H);
    for (int i = 0; i < a.W; i++)
    {
     for (int j = 0; j < a.H; j++)
     {
      ret[i, j] = Calculator.Sum(a[i, j], b[i, j]);
     }
    }

    return ret;
   }
  }

  public static Matrix<T> operator -(Matrix<T> a, Matrix<T> b)
  {
   if (a.W != b.W)
    return null;
   else if (a.H != b.H)
    return null;
   else
   {
    Matrix<T> ret = new Matrix<T>(a.W, a.H);
    for (int i = 0; i < a.W; i++)
    {
     for (int j = 0; j < a.H; j++)
     {
      ret[i, j] = Calculator.Difference(a[i, j], b[i, j]);
     }
    }

    return ret;
   }
  }

  public static Matrix<T> operator *(Matrix<T> a, Matrix<T> b)
  {
   if (a.cols != b.rows)
    throw new FormatException("Cannot multiply : a.W = " + a.W.ToString() + " with b.H = " + b.H.ToString());
   else
   {
    Matrix<T> R = new Matrix<T>(a.rows, b.cols);
    for (int i = 0; i < R.rows; i++)
     for (int j = 0; j < R.cols; j++)
      for (int k = 0; k < a.cols; k++)
      {
       R[i, j] = Calculator.Sum(R[i, j], Calculator.Multiply(a[i, k], b[k, j]));
      }

    return R;
   }
  }
 }

 public static class Calculator
 {
  public static T Sum<T>(T a, T b)
  {
   return Number<T>.Sum(a, b);
  }
 }

 public interface ICalculator<T>
 {
  T Sum(T a, T b);
  T Difference(T a, T b);
  int Compare(T a, T b);
  T Multiply(T a, T b);
  T Divide(T a, T b);
  T Divide(T a, int b);
 }

 struct Int32Calculator : ICalculator<Int32>
 {
  public Int32 Sum(Int32 a, Int32 b)
  {
   return a + b;
  }

  public Int32 Difference(Int32 a, Int32 b)
  {
   return a - b;
  }

  public int Compare(Int32 a, Int32 b)
  {
   return Difference(a, b);
  }

  public int Multiply(Int32 a, Int32 b)
  {
   return a * b;
  }

  public int Divide(Int32 a, Int32 b)
  {
   return a / b;
  }
 }

 struct Int64Calculator : ICalculator<Int64>
 {
  public Int64 Sum(Int64 a, Int64 b)
  {
   return a + b;
  }

  public Int64 Difference(Int64 a, Int64 b)
  {
   return a - b;
  }

  public int Compare(Int64 a, Int64 b)
  {
   if (a > b)
   {
    return 1;
   }
   else if (a < b)
   {
    return -1;
   }
   else
   {
    return 0;
   }
  }

  public Int64 Multiply(Int64 a, Int64 b)
  {
   return a * b;
  }

  public Int64 Divide(Int64 a, Int64 b)
  {
   return a / b;
  }

  public Int64 Divide(Int64 a, int b)
  {
   return a / b;
  }
 }

 struct SingleCalculator : ICalculator<Single>
 {
  public Single Sum(Single a, Single b)
  {
   return a + b;
  }

  public Single Difference(Single a, Single b)
  {
   return a - b;
  }

  public int Compare(Single a, Single b)
  {
   if (a > b)
   {
    return 1;
   }
   else if (a < b)
   {
    return -1;
   }
   else
   {
    return 0;
   }
  }

  public Single Multiply(Single a, Single b)
  {
   return a * b;
  }

  public Single Divide(Single a, Single b)
  {
   return a / b;
  }

  public Single Divide(Single a, int b)
  {
   return a / b;
  }
 }

 struct DoubleCalculator : ICalculator<double>
 {
  public double Sum(double a, double b)
  {
   return a + b;
  }

  public double Difference(double a, double b)
  {
   return a - b;
  }

  public int Compare(double a, double b)
  {
   if (a > b)
   {
    return 1;
   }
   else if (a < b)
   {
    return -1;
   }
   else
   {
    return 0;
   }
  }

  public double Multiply(double a, double b)
  {
   return a * b;
  }

  public Double Divide(Double a, Double b)
  {
   return a / b;
  }

  public Double Divide(Double a, int b)
  {
   return a / b;
  }
 }

 struct StringCalculator : ICalculator<string>
 {
  public string Sum(string a, string b)
  {
   return a + b;
  }

  public string Difference(string a, string b)
  {
   if (b.Length < a.Length)
   {
    return a.Substring(0, b.Length);
   }
   else
   {
    return "";
   }
  }

  public int Compare(string a, string b)
  {
   return a.CompareTo(b);
  }

  public string Multiply(string a, string b)
  {
   if (a.Length == 1 && b.Length == 1)
   {
    return ((char)(((byte)a[0] * (byte)b[0]) % 256)) + "";
   }

   int bigLength = Math.Max(a.Length, b.Length);
   while (a.Length < bigLength)
   {
    a = " " + a;
   }

   while (b.Length < bigLength)
   {
    b = " " + b;
   }

   string result = "";
   for (int i = 0; i < bigLength; i++)
   {
    Number<string> numA = a[i] + "";
    Number<string> numB = b[i] + "";
    result += numA * numB;
   }

   return result;
  }

  public String Divide(String a, String b)
  {
   return String.Format("{0} / {1}", a, b);
  }

  public String Divide(String a, int b)
  {
   return String.Format("{0} / {1}", a, b);
  }
 }

 public class Number<T>
 {
  private T value;
  public Number(T value)
  {
   this.value = value;
   Type calculatorType = GetCalculatorType();
   fCalculator = Activator.CreateInstance(calculatorType) as ICalculator<T>;
  }

  public static Type GetCalculatorType()
  {
   Type tType = typeof (T);
   Type calculatorType = null;
   if (tType == typeof (Int32))
   {
    calculatorType = typeof (Int32Calculator);
   }
   else if (tType == typeof (Int64))
   {
    calculatorType = typeof (Int64Calculator);
   }
   else if (tType == typeof (Double))
   {
    calculatorType = typeof (DoubleCalculator);
   }
   else if (tType == typeof (string))
   {
    calculatorType = typeof (StringCalculator);
   }
   else
   {
    throw new InvalidCastException(String.Format("Unsupported Type- Type {0} does not have a partner implementation of interface ICalculator<T> and cannot be used in generic arithmetic using type Number<T>", tType.Name));
   }

   return calculatorType;
  }

  private static ICalculator<T> fCalculator = null;
  public static ICalculator<T> Calculator
  {
   get
   {
    if (fCalculator == null)
    {
     MakeCalculator();
    }

    return fCalculator;
   }
  }

  public static void MakeCalculator()
  {
   Type calculatorType = GetCalculatorType();
   fCalculator = Activator.CreateInstance(calculatorType) as ICalculator<T>;
  }

#region operation methods
  public static T Sum(T a, T b)
  {
   return Calculator.Sum(a, b);
  }

  public static T Difference(T a, T b)
  {
   return Calculator.Difference(a, b);
  }

  public static int Compare(T a, T b)
  {
   return Calculator.Compare(a, b);
  }

  public static T Multiply(T a, T b)
  {
   return Calculator.Multiply(a, b);
  }

  public static T Divide(T a, T b)
  {
   return Calculator.Divide(a, b);
  }

  public static T Divide(T a, int b)
  {
   return Calculator.Divide(a, b);
  }

#endregion
#region Operators
  public static implicit operator Number<T>(T a)
  {
   return new Number<T>(a);
  }

  public static implicit operator T(Number<T> a)
  {
   return a.value;
  }

  public static Number<T> operator +(Number<T> a, Number<T> b)
  {
   return Calculator.Sum(a.value, b.value);
  }

  public static Number<T> operator -(Number<T> a, Number<T> b)
  {
   return Calculator.Difference(a, b);
  }

  public static bool operator>(Number<T> a, Number<T> b)
  {
   return Calculator.Compare(a, b) > 0;
  }

  public static bool operator <(Number<T> a, Number<T> b)
  {
   return Calculator.Compare(a, b) < 0;
  }

  public static Number<T> operator *(Number<T> a, Number<T> b)
  {
   return Calculator.Multiply(a, b);
  }

  public static Number<T> operator /(Number<T> a, Number<T> b)
  {
   return Calculator.Divide(a, b);
  }

  public static Number<T> operator /(Number<T> a, int b)
  {
   return Calculator.Divide(a, b);
  }
#endregion
 }
}

#if (ASD)
#region DataStructures
namespace DS.Common
{
 public static class Comparers
 {
  public static bool IsNumber<T>(this T value)
  {
   if (value is sbyte)
    return true;
   if (value is byte)
    return true;
   if (value is short)
    return true;
   if (value is ushort)
    return true;
   if (value is int)
    return true;
   if (value is uint)
    return true;
   if (value is long)
    return true;
   if (value is ulong)
    return true;
   if (value is float)
    return true;
   if (value is double)
    return true;
   if (value is decimal)
    return true;
   return false;
  }

  public static bool IsEqualTo<T>(this T firstValue, T secondValue)where T : IComparable<T>
  {
   return firstValue.Equals(secondValue);
  }

  public static bool IsGreaterThan<T>(this T firstValue, T secondValue)where T : IComparable<T>
  {
   return firstValue.CompareTo(secondValue) > 0;
  }

  public static bool IsLessThan<T>(this T firstValue, T secondValue)where T : IComparable<T>
  {
   return firstValue.CompareTo(secondValue) < 0;
  }

  public static bool IsGreaterThanOrEqualTo<T>(this T firstValue, T secondValue)where T : IComparable<T>
  {
   return (firstValue.IsEqualTo(secondValue) || firstValue.IsGreaterThan(secondValue));
  }

  public static bool IsLessThanOrEqualTo<T>(this T firstValue, T secondValue)where T : IComparable<T>
  {
   return (firstValue.IsEqualTo(secondValue) || firstValue.IsLessThan(secondValue));
  }
 }

 public static class Helpers
 {
  public static void Swap<T>(this IList<T> list, int firstIndex, int secondIndex)
  {
   if (list.Count < 2 || firstIndex == secondIndex)
    return;
   var temp = list[firstIndex];
   list[firstIndex] = list[secondIndex];
   list[secondIndex] = temp;
  }

  public static string PadCenter(this string text, int newW, char fillerCharacter = ' ')
  {
   if (string.IsNullOrEmpty(text))
    return text;
   int length = text.Length;
   int cTP = newW - length;
   if (cTP < 0)
    throw new AE("New w must be greater than string length.");
   int pL = cTP / 2 + cTP % 2;
   int pR = cTP / 2;
   StringBuilder rB = new StringBuilder(newW);
   for (int i = 0; i < pL; i++)
    rB.Insert(i, fillerCharacter);
   for (int i = 0; i < length; i++)
    rB.Insert(i + pL, text[i]);
   for (int i = newW - pR; i < newW; i++)
    rB.Insert(i, fillerCharacter);
   return rB.ToString();
  }

  public static void Populate<T>(this T[, ] array, int rows, int columns, T defaultValue = default (T))
  {
   for (int i = 0; i < rows; ++i)
   {
    for (int j = 0; j < columns; ++j)
    {
     array[i, j] = defaultValue;
    }
   }
  }
 }
}

namespace DS.Dictionaries
{
}

namespace DS.Graphs
{
}

namespace DS.Hashing
{
}

namespace DS.Heaps
{
 public interface IMaxHeap<T>
  where T : System.IComparable<T>
 {
  int Count
  {
   get;
  }

  bool IsEmpty
  {
   get;
  }

  void Initialize(System.Collections.Generic.IList<T> newCollection);
  void Add(T heapKey);
  T Peek();
  void RemoveMax();
  T ExtractMax();
  void Clear();
  void RebuildHeap();
  T[] ToArray();
  System.Collections.Generic.List<T> ToList();
  IMinHeap<T> ToMinHeap();
 }

 public interface IMinHeap<T>
  where T : System.IComparable<T>
 {
  int Count
  {
   get;
  }

  bool IsEmpty
  {
   get;
  }

  void Initialize(System.Collections.Generic.IList<T> newCollection);
  void Add(T heapKey);
  T Peek();
  void RemoveMin();
  T ExtractMin();
  void Clear();
  void RebuildHeap();
  T[] ToArray();
  System.Collections.Generic.List<T> ToList();
  IMaxHeap<T> ToMaxHeap();
 }
}

namespace DS.Lists
{
 public class ArrayList<T> : IEnumerable<T>
 {
  bool DefaultMaxCapacityIsX64 = true;
  bool IsMaximumCapacityReached = false;
  public const int MAXIMUM_ARRAY_LENGTH_x64 = 2146435071;
  public const int MAXIMUM_ARRAY_LENGTH_x86 = 134217728;
  private readonly T[] _emptyArray = new T[0];
  private const int _defaultCapacity = 8;
  private T[] _collection;
  private int _size
  {
   get;
   set;
  }

  public ArrayList(): this (capacity: 0)
  {
  }

  public ArrayList(int capacity)
  {
   if (capacity < 0)
   {
    throw new ArgumentOutOfRangeException();
   }
   else if (capacity == 0)
   {
    _collection = _emptyArray;
   }
   else
   {
    _collection = new T[capacity];
   }

   _size = 0;
  }

  private void _ensureCapacity(int minCapacity)
  {
   if (_collection.Length < minCapacity && IsMaximumCapacityReached == false)
   {
    int newCapacity = (_collection.Length == 0 ? _defaultCapacity : _collection.Length * 2);
    int maxCapacity = (DefaultMaxCapacityIsX64 == true ? MAXIMUM_ARRAY_LENGTH_x64 : MAXIMUM_ARRAY_LENGTH_x86);
    if (newCapacity < minCapacity)
     newCapacity = minCapacity;
    if (newCapacity >= maxCapacity)
    {
     newCapacity = maxCapacity - 1;
     IsMaximumCapacityReached = true;
    }

    this._resizeCapacity(newCapacity);
   }
  }

  private void _resizeCapacity(int newCapacity)
  {
   if (newCapacity != _collection.Length && newCapacity > _size)
   {
    try
    {
     Array.Resize<T>(ref _collection, newCapacity);
    }
    catch (OutOfMemoryException)
    {
     if (DefaultMaxCapacityIsX64 == true)
     {
      DefaultMaxCapacityIsX64 = false;
      _ensureCapacity(newCapacity);
     }

     throw;
    }
   }
  }

  public int Count
  {
   get
   {
    return _size;
   }
  }

  public int Capacity
  {
   get
   {
    return _collection.Length;
   }
  }

  public bool IsEmpty
  {
   get
   {
    return (Count == 0);
   }
  }

  public T First
  {
   get
   {
    return _collection[0];
   }
  }

  public T Last
  {
   get
   {
    return _collection[Count - 1];
   }
  }

  public T this[int index]
  {
   get
   {
    return _collection[index];
   }

   set
   {
    _collection[index] = value;
   }
  }

  public void Add(T dataItem)
  {
   if (_size == _collection.Length)
   {
    _ensureCapacity(_size + 1);
   }

   _collection[_size++] = dataItem;
  }

  public void AddRange(IEnumerable<T> elements)
  {
   if (elements == null)
    throw new ArgumentNullException();
   if (((uint)_size + elements.Count()) > MAXIMUM_ARRAY_LENGTH_x64)
    throw new OverflowException();
   if (elements.Any())
   {
    _ensureCapacity(_size + elements.Count());
    foreach (var element in elements)
     this.Add(element);
   }
  }

  public void AddRepeatedly(T value, int count)
  {
   if (count < 0)
    throw new ArgumentOutOfRangeException();
   if (((uint)_size + count) > MAXIMUM_ARRAY_LENGTH_x64)
    throw new OverflowException();
   if (count > 0)
   {
    _ensureCapacity(_size + count);
    for (int i = 0; i < count; i++)
     this.Add(value);
   }
  }

  public void InsertAt(T dataItem, int index)
  {
   if (_size == _collection.Length)
   {
    _ensureCapacity(_size + 1);
   }

   if (index < _size)
   {
    Array.Copy(_collection, index, _collection, index + 1, (_size - index));
   }

   _collection[index] = dataItem;
   _size++;
  }

  public bool Remove(T dataItem)
  {
   int index = IndexOf(dataItem);
   if (index >= 0)
   {
    RemoveAt(index);
    return true;
   }

   return false;
  }

  public void RemoveAt(int index)
  {
   _size--;
   if (index < _size)
   {
    Array.Copy(_collection, index + 1, _collection, index, (_size - index));
   }

   _collection[_size] = default (T);
  }

  public void Clear()
  {
   if (_size > 0)
   {
    _size = 0;
    Array.Clear(_collection, 0, _size);
    _collection = _emptyArray;
   }
  }

  public void Resize(int newSize)
  {
   Resize(newSize, default (T));
  }

  public void Resize(int newSize, T defaultValue)
  {
   int currentSize = this.Count;
   if (newSize < currentSize)
   {
    this._ensureCapacity(newSize);
   }
   else if (newSize > currentSize)
   {
    if (newSize > this._collection.Length)
     this._ensureCapacity(newSize + 1);
    this.AddRange(Enumerable.Repeat<T>(defaultValue, newSize - currentSize));
   }
  }

  public void Reverse()
  {
   Reverse(0, _size);
  }

  public void Reverse(int startIndex, int count)
  {
   if (count < 0 || startIndex > (_size - count))
   {
    throw new ArgumentOutOfRangeException();
   }

   Array.Reverse(_collection, startIndex, count);
  }

  public void ForEach(Action<T> action)
  {
   if (action == null)
   {
    throw new ArgumentNullException();
   }

   for (int i = 0; i < _size; ++i)
   {
    action(_collection[i]);
   }
  }

  public bool Contains(T dataItem)
  {
   if ((Object)dataItem == null)
   {
    for (int i = 0; i < _size; ++i)
    {
     if ((Object)_collection[i] == null)
      return true;
    }
   }
   else
   {
    EqualityComparer<T> comparer = EqualityComparer<T>.Default;
    for (int i = 0; i < _size; ++i)
    {
     if (comparer.Equals(_collection[i], dataItem))
      return true;
    }
   }

   return false;
  }

  public bool Contains(T dataItem, IEqualityComparer<T> comparer)
  {
   if (comparer == null)
   {
    throw new ArgumentNullException();
   }

   if ((Object)dataItem == null)
   {
    for (int i = 0; i < _size; ++i)
    {
     if ((Object)_collection[i] == null)
      return true;
    }
   }
   else
   {
    for (int i = 0; i < _size; ++i)
    {
     if (comparer.Equals(_collection[i], dataItem))
      return true;
    }
   }

   return false;
  }

  public bool Exists(Predicate<T> searchMatch)
  {
   return (FindIndex(searchMatch) != -1);
  }

  public int FindIndex(Predicate<T> searchMatch)
  {
   return FindIndex(0, _size, searchMatch);
  }

  public int FindIndex(int startIndex, Predicate<T> searchMatch)
  {
   return FindIndex(startIndex, (_size - startIndex), searchMatch);
  }

  public int FindIndex(int startIndex, int count, Predicate<T> searchMatch)
  {
   if (count < 0 || startIndex > (_size - count))
   {
    throw new ArgumentOutOfRangeException();
   }

   if (searchMatch == null)
   {
    throw new ArgumentNullException();
   }

   int endIndex = startIndex + count;
   for (int index = startIndex; index < endIndex; ++index)
   {
    if (searchMatch(_collection[index]) == true)
     return index;
   }

   return -1;
  }

  public int IndexOf(T dataItem)
  {
   return IndexOf(dataItem, 0, _size);
  }

  public int IndexOf(T dataItem, int startIndex)
  {
   return IndexOf(dataItem, startIndex, _size);
  }

  public int IndexOf(T dataItem, int startIndex, int count)
  {
   if (count < 0 || startIndex > (_size - count))
   {
    throw new ArgumentOutOfRangeException();
   }

   return Array.IndexOf(_collection, dataItem, startIndex, count);
  }

  public T Find(Predicate<T> searchMatch)
  {
   if (searchMatch == null)
   {
    throw new ArgumentNullException();
   }

   for (int i = 0; i < _size; ++i)
   {
    if (searchMatch(_collection[i]))
    {
     return _collection[i];
    }
   }

   return default (T);
  }

  public ArrayList<T> FindAll(Predicate<T> searchMatch)
  {
   if (searchMatch == null)
   {
    throw new ArgumentNullException();
   }

   ArrayList<T> matchedElements = new ArrayList<T>();
   for (int i = 0; i < _size; ++i)
   {
    if (searchMatch(_collection[i]))
    {
     matchedElements.Add(_collection[i]);
    }
   }

   return matchedElements;
  }

  public ArrayList<T> GetRange(int startIndex, int count)
  {
   if (count < 0 || startIndex > (_size - count))
   {
    throw new ArgumentOutOfRangeException();
   }

   var newArrayList = new ArrayList<T>(count);
   Array.Copy(_collection, startIndex, newArrayList._collection, 0, count);
   newArrayList._size = count;
   return newArrayList;
  }

  public T[] ToArray()
  {
   T[] newArray = new T[Count];
   if (Count > 0)
   {
    Array.Copy(_collection, 0, newArray, 0, Count);
   }

   return newArray;
  }

  public List<T> ToList()
  {
   var newList = new List<T>(this.Count);
   if (this.Count > 0)
   {
    for (int i = 0; i < this.Count; ++i)
    {
     newList.Add(_collection[i]);
    }
   }

   return newList;
  }

  public string ToHumanReadable(bool addHeader = false)
  {
   int i = 0;
   string listAsString = string.Empty;
   string preLineIndent = (addHeader == false ? "" : "\t");
   for (i = 0; i < Count; ++i)
   {
    listAsString = String.Format("{0}{1}[{2}] => {3}\r\n", listAsString, preLineIndent, i, _collection[i]);
   }

   if (addHeader == true)
   {
    listAsString = String.Format("ArrayList of count: {0}.\r\n(\r\n{1})", Count, listAsString);
   }

   return listAsString;
  }

  public IEnumerator<T> GetEnumerator()
  {
   for (int i = 0; i < Count; i++)
   {
    yield return _collection[i];
   }
  }

  System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
  {
   return this.GetEnumerator();
  }
 }
}

namespace DS.Trees
{
}

#endregion
#region Algorithms
namespace AL.Common
{
}

namespace AL.Graphs
{
}

namespace AL.Numeric
{
}

namespace AL.Sorting
{
 public static class QuickSorter
 {
  public static void QuickSort<T>(this IList<T> collection, Comparer<T> comparer = null)
  {
   int startIndex = 0;
   int endIndex = collection.Count - 1;
   comparer = comparer ?? Comparer<T>.Default;
   collection.InternalQuickSort(startIndex, endIndex, comparer);
  }

  private static void InternalQuickSort<T>(this IList<T> collection, int leftmostIndex, int rightmostIndex, Comparer<T> comparer)
  {
   if (leftmostIndex < rightmostIndex)
   {
    int wallIndex = collection.InternalPartition(leftmostIndex, rightmostIndex, comparer);
    collection.InternalQuickSort(leftmostIndex, wallIndex - 1, comparer);
    collection.InternalQuickSort(wallIndex + 1, rightmostIndex, comparer);
   }
  }

  private static int InternalPartition<T>(this IList<T> collection, int leftmostIndex, int rightmostIndex, Comparer<T> comparer)
  {
   int wallIndex, pivotIndex;
   pivotIndex = rightmostIndex;
   T pivotValue = collection[pivotIndex];
   wallIndex = leftmostIndex;
   for (int i = leftmostIndex; i <= (rightmostIndex - 1); i++)
   {
    if (comparer.Compare(collection[i], pivotValue) <= 0)
    {
     collection.Swap(i, wallIndex);
     wallIndex++;
    }
   }

   collection.Swap(wallIndex, pivotIndex);
   return wallIndex;
  }
 }
}
#endregion
#endif

using System;
using System.Collections.Generic;
using System.Text;

namespace C0deforces
{
    class QueueAtTheSchool
    {
        static void Main(string[] args)
        {
            int[] NandT = Array.ConvertAll(Console.ReadLine().Trim().Split(' '), int.Parse);
            string s = Console.ReadLine().Trim();
            StringBuilder sb = new StringBuilder();
            while (NandT[1]-- > 0)
            {
                for (int i = 0; i < s.Length - 1; i++)
                {
                    if (s[i] == 'B' && s[i + 1] == 'G') { sb.Append("GB"); i++; }
                    else { sb.Append(s[i]); }
                }
                s = sb.ToString();
                sb.Clear();
            }
            Console.WriteLine(s);
        }
    }
}

using System;

namespace _266B
{
    static class Program
    {
        static void Main()
        {
            var strings = Console.ReadLine().Split(' ');
            var n = byte.Parse(strings[0]);
            var t = byte.Parse(strings[1]);
            var array = Console.ReadLine().ToCharArray();
            for (var i = 0; i < t; i++)
            {
                for (var j = i; j < n-1; j++)
                {
                    if (array[j] != 'B' || array[j + 1] != 'G') continue;

                    array[j] = 'G';
                    array[j+1] = 'B';
                    ++j;
                }
            }
            for (int i = 0; i < n; i++)
            {
                Console.Write(array[i]);
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace codeforces
{
    class Queue_at_the_School
    {
        static void Main(string[] args)
        {
            string a = Console.ReadLine();
            int n = int.Parse(a.Substring(0, a.IndexOf(' ')));
            int t = int.Parse(a.Substring(a.IndexOf(' ') + 1, a.Length - a.IndexOf(' ') - 1));
            int help = t;
            string b = Console.ReadLine(), c = "";
            for (int i = 0; i < n; i++)
            {
                help = t;
                if (b[i] == 'B')
                {
                    while (help != 0)
                    {
                        if (i == b.Length - 1)
                        {
                            break;
                        }
                        if (b[i + 1] == 'G')
                        {
                            c += "G";
                            i++;
                            help--;
                        }
                        else
                        {
                            break;
                        }
                    }
                    c += "B";
                }
                else
                {
                    c += "G";
                }
            }
            Console.WriteLine(c);
            //Console.ReadKey();
        }
    }
}

using System;

class Program
{
	static void Main()
	{
		string[] inputNum = Console.ReadLine().Split();
		int lengthQue = int.Parse(inputNum[0]);
		int timeStep = int.Parse(inputNum[1]);

		if (lengthQue < 1) return;
		if (timeStep > 50) return;

		string strQue = Console.ReadLine();
		char[] que = strQue.Trim().ToCharArray();

		for (int i = que.Length - 1; i >= 0; i--)
		{
			if (que[i] == 'B')
			{
				MoveToEnd(i, timeStep, que);
			}
		}

		strQue = new String(que);
		Console.WriteLine(strQue);
	}

	private static void MoveToEnd(int indexChar, int steps, char[] que)
	{
		for (int i = indexChar; (i < que.Length - 1 && steps-- > 0); i++)
		{
			if (que[i + 1] == 'B')
			{
				break;
			}

			char temp = que[i + 1];
			que[i + 1] = que[i];
			que[i] = temp;
		}
	}
}

using System;

class Program
{
	static void Main()
	{
		string[] inputNum = Console.ReadLine().Split();
		int lengthQue = int.Parse(inputNum[0]);
		int timeStep = int.Parse(inputNum[1]);

		string strQue = Console.ReadLine();
		char[] que = strQue.ToCharArray();

		for (int i = que.Length - 1; i >= 0; i--)
		{
			if (que[i] == 'B' || que[i] == 'b')
			{
				MoveToEnd(i, timeStep, que);
			}
		}

		strQue = new String(que);
		Console.WriteLine(strQue);

		Console.ReadLine();
	}

	private static void MoveToEnd(int indexChar, int steps, char[] que)
	{
		for (int i = indexChar; (i < que.Length - 1 && steps-- > 0); i++)
		{
			if (que[i + 1] == 'B' || que[i + 1] == 'b')
			{
				break;
			}
			char temp = que[i + 1];
			que[i + 1] = que[i];
			que[i] = temp;
		}
	}
}

using System;

namespace Queue_at_the_School
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] s = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            char[] q = Console.ReadLine().ToCharArray();
            int i = 0;
            while (s[1] != 0)
            {
                while (i < s.Length-1)
                {
                    if (q[i] == 'B' && q[i + 1] == 'G')
                    {
                        q[i] = 'G';
                        q[i + 1] = 'B';
                        i++;
                    }
                    i++;
                }
                s[1]--;
                i = 0;
            }
            Console.WriteLine(q);
            Console.ReadLine();
        }
    }
}

using System;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] p = Console.ReadLine().Split();
            char temp;
            int n = int.Parse(p[0]);
            int t = int.Parse(p[1]);
            char[] s = Console.ReadLine().ToCharArray();
            for (int j = 0; j < t; j++)
            {
                for (int i = 0; i < n - 1; i++)
                {
                    if (s[i] == 'B')
                    {
                        temp = s[i];
                        s[i] = s[i + 1];
                        s[i + 1] = temp;
                        i++;
                    }
                }
            }
            Console.WriteLine(s);
        }
    }
}

using System;
using System.Linq;
using System.Collections.Generic;
using System.Collections;

public class Program
{
	public static void Main()
	{
		var line1=Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
		char[] s=Console.ReadLine().ToCharArray();
		char[] ch=new char[s.Length];

		for(int j=0; j<line1[1]; j++)
		{
		for(int i=0; i<line1[0]-1; i++)
		{
			if(s[i]=='B' && s[i+1]=='G')
			{
				ch[i]='G';
				ch[i+1]='B';
				i++;
			}
			else
			{
				ch[i]=s[i];
				ch[i+1]=s[i+1];
			}
		}
			s=ch;
		}
		for(int k=0; k<line1[0]; k++)
		{
			Console.Write(ch[k]);
		}
	}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication14
{

    class Program
    {

        static void Main(string[] args)
        {
            string nt = Convert.ToString(Console.ReadLine());
            char[] nt1 = nt.ToCharArray();
            int num = 0;

            for(int i = 0; i < nt.Length; i++)
            {
                if (nt1[i] == ' ')
                    num = i;
            }

            int n = 0, t = 0;

            for (int i = 0; i < num; i++)
            {
                n = n + (int)nt1[i] - 48;

                //Console.WriteLine(n);

                if (i+ 1 < num)
                    n = n * 10;
            }

            for (int i = num + 1; i < nt.Length; i++)
            {
                t = t + (int)nt1[i] - 48;

                if (i+1 < nt.Length)
                    t = t * 10;
            }
            /*Console.WriteLine(n);
            Console.WriteLine(t);*/

            //int t = Convert.ToInt32(Console.ReadLine());
            string sq = Convert.ToString(Console.ReadLine());
        int ind = 0;
        char d;

        char[] sq1 = sq.ToCharArray();
        for (int i = 0; i < t; i++)
        {
            for (int j = 0; j < n - 1; j++)

                if (sq1[j] == 'B' && sq1[j + 1] == 'G' && ind == 0)
                {
                    d = sq1[j];
                    sq1[j] = sq1[j + 1];
                    sq1[j + 1] = d;
                    ind = 1;
                }

                else ind = 0;

        }
        for(int i = 0; i < n; i++)
        {
            Console.Write(sq1[i]);

        }

            //Console.ReadKey();

        }
    }

}

using System;
using System.Runtime.Serialization;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] numbers = Array.ConvertAll(Console.ReadLine().Split(' '), Int32.Parse);
            char[] pupils = Console.ReadLine().ToCharArray();
            bool inCircle = false;
            for(int i=0;i<=numbers[1];i++)
            {
                for (int j = 0; j < numbers[0]-1; j ++)
                {
                    if (pupils[j] == 'B' && pupils[j + 1] == 'G')
                    {
                        inCircle = true;
                        pupils[j] = 'G';
                        pupils[j + 1] = 'B';
                        j++;
                    }
                }
                if (inCircle)
                {
                    i++;
                    inCircle = false;
                }
            }
            foreach (char i in pupils)
            {
                Console.Write(i);
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;

namespace codeforces_console_app
{
    class Program
    {
        static void Main(string[] args)
        {
            //var nbRooms = Convert.ToInt32(Console.ReadLine());
            var input = Console.ReadLine().Split(' ').Select(s => Convert.ToInt32(s)).ToList();
            var seconds = input[1];
            var str = Console.ReadLine();
            var result = string.Empty;

            while (seconds > 0){
                for (int i = 0; i < str.Length; i++){
                    if (i + 1 < str.Length && str[i] == 'B' && str[i + 1] == 'G'){
                        result += "GB";
                        i++;
                        continue;
                    }

                    result += str[i];
                }

                str = result;
                seconds--;
            }

            //var coins = Console.ReadLine().Split(' ').Select(s => Convert.ToInt32(s)).ToList().OrderByDescending(s => s);*/

            Console.WriteLine(result);
            Console.ReadLine();
        }
    }
}

using System;

namespace _266_B_Queue_at_the_School
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] token = Console.ReadLine().Split(' ');

            int n = int.Parse(token[0]);
            int t = int.Parse(token[1]);

            string s = Console.ReadLine();
            char[] c = s.ToCharArray();

            for (int i = 0; i < t; i++)
            {
                for (int j = 0; j < n-1; j++)
                {
                    if(c[j] != s[j+1] && c[j] != 'G')
                    {
                        char temp = c[j];
                        c[j] = c[j + 1];
                        c[j + 1] = temp;
                        j += 1;
                    }
                }
            }

            foreach (var item in c)
            {
                Console.Write(item);
            }
        }
    }
}

using System;
class Program
    {
        static void Main(string[] args)
        {
            char[] line;
            int timeOffset;
            int length;
            {
                string[] input = Console.In.ReadToEnd().Split(new char[] { ' ', '\n', '\r', '\t' }, StringSplitOptions.RemoveEmptyEntries);
                line = input[2].ToCharArray();
                timeOffset = int.Parse(input[1]);
                length = int.Parse(input[0]);
            }
            {
                char temp;
                for (int i = 0; i < timeOffset; ++i)
                {
                    for (int j = length - 1; j > 0; --j)
                    {
                        if (line[j] == 'G' && line[j - 1] == 'B')
                         { temp = line[j]; line[j] = line[j - 1]; line[j - 1] = temp; }
                    }
                }
            }
            Console.WriteLine(new string(line));
        }
    }

using System;
using System.Collections.Generic;
using System.Text;

namespace ACM
{
	class Program
	{
		static void Main(string[] args)
		{
			string[] s = Console.ReadLine().Split(new char[]{' '}, StringSplitOptions.RemoveEmptyEntries);
			int n = int.Parse(s[0]);
			int k = int.Parse(s[1]);

			string r = Console.ReadLine();
			List<int> boys = new List<int>();
			for (int i = 0; i < n; i++)
				if (r[i] == 'B')
					boys.Add(i);

			int q = Math.Max(boys[boys.Count - 1], n - 1);
			for (int j = 0; j < k; j++)
				for (int i = 0; i < boys.Count; i++)
					if (boys[i] < q)
						boys[i]++;

			r = "";
			for (int i = 0; i < n; i++)
				if (boys.Contains(i))
					r += 'B';
				else
					r += 'G';
			Console.WriteLine(r);

			//Console.ReadKey();
		}
	}
}

#define ASD
#if (Debug)
#define Trace
#endif
#if (ASD)
using DS.Common;
using DS.Dictionaries;
using DS.Graphs;
using DS.Heaps;
using DS.Lists;
using DS.Trees;
using DS;
using AL;
using AL.Common;
using AL.Graphs;
using AL.Numeric;
using AL.Sorting;
#endif
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using GenericArithmetic;
using System.Reflection;
using System.Windows;
using System.Text.RegularExpressions;
using csConsoleforStudy;
using System.Resources;
using System.Runtime.Serialization;

namespace csConsoleforStudy
{
 class Program
 {
  const double MemoryLimit = 2.56;
  const double TimeLimit = 4000;
  static Stream fsr;
  static FileStream fsw;
  static TextReader tr;
  static TextWriter tw;
  static Thread t;
  static Thread mainThread = Thread.CurrentThread;
  static Stopwatch sw = new Stopwatch();
  static DefaultTraceListener Logger;
  static long maxUsedMemory = 0;
  static void Main(string[] args)
  {
   OpenStream();
   Solver s = new Solver();
   s.Solve();
   CloseStream();
  }

  static void OpenStream()
  {
#if (Debug)
#endif
  }

  static void CloseStream()
  {
#if (Debug)
#endif
  }

  static void CheckMemory()
  {
#if (Debug)
#endif
  }
 }

 class Solver
 {
  public void Solve()
  {
   var l1 = ria();
   var n = l1[0];
   var t = l1[1];
   var l2 = Console.ReadLine();
   char[] State = l2.ToCharArray();
   for (int round = 0; round < t; round++)
   {
    for (int i = 0; i < State.Length; i++)
    {
     if (i == n - 1)
     {
     }
     else if (i == 0)
     {
      if (State[i + 1] == 'G' && State[i] == 'B')
      {
       swap(State, i, i + 1);
      }
     }
     else
     {
      if (State[i + 1] == 'G' && State[i] == 'B')
      {
       swap(State, i, i + 1);
      }
     }
    }
   }

   Console.WriteLine(State);
  }

  public char[] swap(char[] str, int a, int b)
  {
   Tuple<char, char> chars = new Tuple<char, char>(str[a], str[b]);
   str[a] = chars.Item2;
   str[b] = chars.Item1;
   return str;
  }

#region SolverUtils
  private const double AbsoluteError = 1e-10;
  private const double RelativeError = 1e-8;
  private static int NextInt()
  {
   int c;
   int res = 0;
   do
   {
    c = Console.Read();
    if (c == -1)
     return res;
   }
   while (c < '0' || c > '9');
   res = c - '0';
   while (true)
   {
    c = Console.Read();
    if (c < '0' || c > '9')
     return res;
    res *= 10;
    res += c - '0';
   }
  }

  static string rs()
  {
   return Console.ReadLine();
  }

  static int ri()
  {
   return int.Parse(Console.ReadLine());
  }

  static long rl()
  {
   return long.Parse(Console.ReadLine());
  }

  static double rd()
  {
   return double.Parse(Console.ReadLine());
  }

  static string[] rsa()
  {
   return Console.ReadLine().Split(' ');
  }

  static int[] ria()
  {
   return Array.ConvertAll(Console.ReadLine().Split(' '), e => int.Parse(e));
  }

  static long[] rla()
  {
   return Array.ConvertAll(Console.ReadLine().Split(' '), e => long.Parse(e));
  }

  static double[] rda()
  {
   return Array.ConvertAll(Console.ReadLine().Split(' '), e => double.Parse(e));
  }

  static void ReadLineAndAssign(string type, params object[] p)
  {
   dynamic input;
   if (type.StartsWith("i"))
    input = ria();
   else if (type.StartsWith("l"))
    input = rla();
   else if (type.StartsWith("d"))
    input = rda();
   else
    throw new AE("no match " + type.ToString());
   for (int i = 0; i < p.Length; i++)
   {
    p[i] = input[i];
   }
  }

  static void SwapIfGreater<T>(ref T lhs, ref T rhs)where T : IComparable<T>
  {
   T temp;
   if (lhs.CompareTo(rhs) > 0)
   {
    temp = lhs;
    lhs = rhs;
    rhs = temp;
   }
  }

  static bool DoubleEqual(double a, double b)
  {
   double diff = Math.Abs(a - b);
   if (diff < AbsoluteError)
    return true;
   return diff <= RelativeError * Math.Max(Math.Abs(a), Math.Abs(b));
  }

  static dynamic abs(dynamic num)
  {
   return Math.Abs(num);
  }

  static dynamic max(dynamic a, dynamic b)
  {
   return Math.Max(a, b);
  }
 }

 static class MyExtensions
 {
  public static string Reverse(this string str)
  {
   StringBuilder sb = new StringBuilder(str.Length);
   for (int i = str.Length - 1; i >= 0; i--)
   {
    sb.Append(str[i]);
   }

   return sb.ToString();
  }
 }

#endregion
 struct Pair
 {
  public long X, Y;
  public Pair(long x, long y)
  {
   X = x;
   Y = y;
  }
 }

 struct Bit
 {
  bool state;
  public Bit(bool state)
  {
   this.state = state;
  }

  public override int GetHashCode()
  {
   return base.GetHashCode();
  }

  public override string ToString()
  {
   return state.ToString();
  }

  public override bool Equals(object other)
  {
   if (other is Bit)
   {
    return state == ((Bit)other).state;
   }
   else
   {
    if ((int)other == 1 && state == true)
     return true;
    else if ((int)other == 0 && state == false)
     return true;
    else
     return base.Equals(other);
   }
  }

  public static implicit operator bool (Bit a)
  {
   return a.state;
  }

  public static implicit operator Bit(bool a)
  {
   return new Bit(a);
  }

  public static implicit operator Bit(int a)
  {
   if (a == 0)
    return new Bit(false);
   return new Bit(true);
  }

  public static bool operator ==(Bit a, Bit b)
  {
   return a.state == b.state;
  }

  public static bool operator !=(Bit a, Bit b)
  {
   return a.state != b.state;
  }

  public static Bit operator !(Bit a)
  {
   return new Bit(!a.state);
  }

  public static Bit operator +(Bit a, Bit b)
  {
   return new Bit(a.state || b.state);
  }

  public static Bit operator *(Bit a, Bit b)
  {
   return new Bit(a.state && b.state);
  }

  public static Bit operator ^(Bit a, Bit b)
  {
   return new Bit(a.state ^ b.state);
  }
 }

#if (MS)
#endif
#region Exceptions
 [Serializable]
 internal class IOE : InvalidOperationException
 {
  public IOE()
  {
  }

  public IOE(string message): base (message)
  {
  }

  public IOE(string message, Exception innerException): base (message, innerException)
  {
  }

  protected IOE(SerializationInfo info, StreamingContext context): base (info, context)
  {
  }
 }

 [Serializable]
 internal class AE : ArgumentException
 {
  public AE()
  {
  }

  public AE(string message): base (message)
  {
  }

  public AE(string message, Exception innerException): base (message, innerException)
  {
  }

  protected AE(SerializationInfo info, StreamingContext context): base (info, context)
  {
  }
 }
#endregion
}

namespace GenericArithmetic
{
 public class Vector<T>
 {
  public static readonly ICalculator<T> Calculator = Number<T>.Calculator;
  public T X
  {
   get;
   set;
  }

  public T Y
  {
   get;
   set;
  }

  public Vector(T x, T y)
  {
   X = x;
   Y = y;
  }

  public override bool Equals(object obj)
  {
   return base.Equals(obj);
  }

  public override int GetHashCode()
  {
   return base.GetHashCode();
  }

  public static bool operator ==(Vector<T> a, Vector<T> b)
  {
   return EqualityComparer<T>.Default.Equals(a.X, b.X) && EqualityComparer<T>.Default.Equals(a.Y, b.Y);
  }

  public static bool operator !=(Vector<T> a, Vector<T> b)
  {
   return !(EqualityComparer<T>.Default.Equals(a.X, b.X) && EqualityComparer<T>.Default.Equals(a.Y, b.Y));
  }

  public static Vector<T> operator !(Vector<T> a)
  {
   return new Vector<T>(Calculator.Difference(new Number<T>(default (T)), a.X), Calculator.Difference(new Number<T>(default (T)), a.Y));
  }

  public static Vector<T> operator +(Vector<T> a, Vector<T> b)
  {
   return new Vector<T>(Calculator.Sum(a.X, b.X), Calculator.Sum(a.Y, b.Y));
  }

  public static Vector<T> operator -(Vector<T> a, Vector<T> b)
  {
   return new Vector<T>(Calculator.Difference(a.X, b.X), Calculator.Difference(a.Y, b.Y));
  }
 }

 public class Matrix<T>
 {
  public static readonly ICalculator<T> Calculator = Number<T>.Calculator;
  public int W
  {
   get;
   set;
  }

  public int H
  {
   get;
   set;
  }

  public int rows
  {
   get
   {
    return H;
   }

   set
   {
    H = value;
   }
  }

  public int cols
  {
   get
   {
    return W;
   }

   set
   {
    W = value;
   }
  }

  public T[, ] Map
  {
   get;
   set;
  }

  public T this[int x, int y]
  {
   get
   {
    return Map[x, y];
   }

   set
   {
    Map[x, y] = value;
   }
  }

  public Matrix(T[, ] map)
  {
   Map = map;
   W = map.GetLength(0);
   H = map.GetLength(1);
  }

  public Matrix(int w, int h, T defaultValue = default (T))
  {
   W = w;
   H = h;
   Map = new T[W, H];
#if (ASD)
   Map.Populate(W, H, defaultValue);
#endif
  }

  public override bool Equals(object obj)
  {
   if (obj is Matrix<T>)
   {
    return this == (Matrix<T>)obj;
   }

   return base.Equals(obj);
  }

  public override int GetHashCode()
  {
   return base.GetHashCode();
  }

  public static bool operator ==(Matrix<T> a, Matrix<T> b)
  {
   bool ret = true;
   if (a.Map != b.Map)
    ret = false;
   else if (a.W != b.W)
    ret = false;
   else if (a.H != b.H)
    ret = false;
   return ret;
  }

  public static bool operator !=(Matrix<T> a, Matrix<T> b)
  {
   bool ret = true;
   if (a.Map != b.Map)
    ret = false;
   else if (a.W != b.W)
    ret = false;
   else if (a.H != b.H)
    ret = false;
   return !ret;
  }

  public static Matrix<T> operator +(Matrix<T> a, Matrix<T> b)
  {
   if (a.W != b.W)
    return null;
   else if (a.H != b.H)
    return null;
   else
   {
    Matrix<T> ret = new Matrix<T>(a.W, a.H);
    for (int i = 0; i < a.W; i++)
    {
     for (int j = 0; j < a.H; j++)
     {
      ret[i, j] = Calculator.Sum(a[i, j], b[i, j]);
     }
    }

    return ret;
   }
  }

  public static Matrix<T> operator -(Matrix<T> a, Matrix<T> b)
  {
   if (a.W != b.W)
    return null;
   else if (a.H != b.H)
    return null;
   else
   {
    Matrix<T> ret = new Matrix<T>(a.W, a.H);
    for (int i = 0; i < a.W; i++)
    {
     for (int j = 0; j < a.H; j++)
     {
      ret[i, j] = Calculator.Difference(a[i, j], b[i, j]);
     }
    }

    return ret;
   }
  }

  public static Matrix<T> operator *(Matrix<T> a, Matrix<T> b)
  {
   if (a.cols != b.rows)
    throw new FormatException("Cannot multiply : a.W = " + a.W.ToString() + " with b.H = " + b.H.ToString());
   else
   {
    Matrix<T> R = new Matrix<T>(a.rows, b.cols);
    for (int i = 0; i < R.rows; i++)
     for (int j = 0; j < R.cols; j++)
      for (int k = 0; k < a.cols; k++)
      {
       R[i, j] = Calculator.Sum(R[i, j], Calculator.Multiply(a[i, k], b[k, j]));
      }

    return R;
   }
  }
 }

 public static class Calculator
 {
  public static T Sum<T>(T a, T b)
  {
   return Number<T>.Sum(a, b);
  }
 }

 public interface ICalculator<T>
 {
  T Sum(T a, T b);
  T Difference(T a, T b);
  int Compare(T a, T b);
  T Multiply(T a, T b);
  T Divide(T a, T b);
  T Divide(T a, int b);
 }

 struct Int32Calculator : ICalculator<Int32>
 {
  public Int32 Sum(Int32 a, Int32 b)
  {
   return a + b;
  }

  public Int32 Difference(Int32 a, Int32 b)
  {
   return a - b;
  }

  public int Compare(Int32 a, Int32 b)
  {
   return Difference(a, b);
  }

  public int Multiply(Int32 a, Int32 b)
  {
   return a * b;
  }

  public int Divide(Int32 a, Int32 b)
  {
   return a / b;
  }
 }

 struct Int64Calculator : ICalculator<Int64>
 {
  public Int64 Sum(Int64 a, Int64 b)
  {
   return a + b;
  }

  public Int64 Difference(Int64 a, Int64 b)
  {
   return a - b;
  }

  public int Compare(Int64 a, Int64 b)
  {
   if (a > b)
   {
    return 1;
   }
   else if (a < b)
   {
    return -1;
   }
   else
   {
    return 0;
   }
  }

  public Int64 Multiply(Int64 a, Int64 b)
  {
   return a * b;
  }

  public Int64 Divide(Int64 a, Int64 b)
  {
   return a / b;
  }

  public Int64 Divide(Int64 a, int b)
  {
   return a / b;
  }
 }

 struct SingleCalculator : ICalculator<Single>
 {
  public Single Sum(Single a, Single b)
  {
   return a + b;
  }

  public Single Difference(Single a, Single b)
  {
   return a - b;
  }

  public int Compare(Single a, Single b)
  {
   if (a > b)
   {
    return 1;
   }
   else if (a < b)
   {
    return -1;
   }
   else
   {
    return 0;
   }
  }

  public Single Multiply(Single a, Single b)
  {
   return a * b;
  }

  public Single Divide(Single a, Single b)
  {
   return a / b;
  }

  public Single Divide(Single a, int b)
  {
   return a / b;
  }
 }

 struct DoubleCalculator : ICalculator<double>
 {
  public double Sum(double a, double b)
  {
   return a + b;
  }

  public double Difference(double a, double b)
  {
   return a - b;
  }

  public int Compare(double a, double b)
  {
   if (a > b)
   {
    return 1;
   }
   else if (a < b)
   {
    return -1;
   }
   else
   {
    return 0;
   }
  }

  public double Multiply(double a, double b)
  {
   return a * b;
  }

  public Double Divide(Double a, Double b)
  {
   return a / b;
  }

  public Double Divide(Double a, int b)
  {
   return a / b;
  }
 }

 struct StringCalculator : ICalculator<string>
 {
  public string Sum(string a, string b)
  {
   return a + b;
  }

  public string Difference(string a, string b)
  {
   if (b.Length < a.Length)
   {
    return a.Substring(0, b.Length);
   }
   else
   {
    return "";
   }
  }

  public int Compare(string a, string b)
  {
   return a.CompareTo(b);
  }

  public string Multiply(string a, string b)
  {
   if (a.Length == 1 && b.Length == 1)
   {
    return ((char)(((byte)a[0] * (byte)b[0]) % 256)) + "";
   }

   int bigLength = Math.Max(a.Length, b.Length);
   while (a.Length < bigLength)
   {
    a = " " + a;
   }

   while (b.Length < bigLength)
   {
    b = " " + b;
   }

   string result = "";
   for (int i = 0; i < bigLength; i++)
   {
    Number<string> numA = a[i] + "";
    Number<string> numB = b[i] + "";
    result += numA * numB;
   }

   return result;
  }

  public String Divide(String a, String b)
  {
   return String.Format("{0} / {1}", a, b);
  }

  public String Divide(String a, int b)
  {
   return String.Format("{0} / {1}", a, b);
  }
 }

 public class Number<T>
 {
  private T value;
  public Number(T value)
  {
   this.value = value;
   Type calculatorType = GetCalculatorType();
   fCalculator = Activator.CreateInstance(calculatorType) as ICalculator<T>;
  }

  public static Type GetCalculatorType()
  {
   Type tType = typeof (T);
   Type calculatorType = null;
   if (tType == typeof (Int32))
   {
    calculatorType = typeof (Int32Calculator);
   }
   else if (tType == typeof (Int64))
   {
    calculatorType = typeof (Int64Calculator);
   }
   else if (tType == typeof (Double))
   {
    calculatorType = typeof (DoubleCalculator);
   }
   else if (tType == typeof (string))
   {
    calculatorType = typeof (StringCalculator);
   }
   else
   {
    throw new InvalidCastException(String.Format("Unsupported Type- Type {0} does not have a partner implementation of interface ICalculator<T> and cannot be used in generic arithmetic using type Number<T>", tType.Name));
   }

   return calculatorType;
  }

  private static ICalculator<T> fCalculator = null;
  public static ICalculator<T> Calculator
  {
   get
   {
    if (fCalculator == null)
    {
     MakeCalculator();
    }

    return fCalculator;
   }
  }

  public static void MakeCalculator()
  {
   Type calculatorType = GetCalculatorType();
   fCalculator = Activator.CreateInstance(calculatorType) as ICalculator<T>;
  }

#region operation methods
  public static T Sum(T a, T b)
  {
   return Calculator.Sum(a, b);
  }

  public static T Difference(T a, T b)
  {
   return Calculator.Difference(a, b);
  }

  public static int Compare(T a, T b)
  {
   return Calculator.Compare(a, b);
  }

  public static T Multiply(T a, T b)
  {
   return Calculator.Multiply(a, b);
  }

  public static T Divide(T a, T b)
  {
   return Calculator.Divide(a, b);
  }

  public static T Divide(T a, int b)
  {
   return Calculator.Divide(a, b);
  }

#endregion
#region Operators
  public static implicit operator Number<T>(T a)
  {
   return new Number<T>(a);
  }

  public static implicit operator T(Number<T> a)
  {
   return a.value;
  }

  public static Number<T> operator +(Number<T> a, Number<T> b)
  {
   return Calculator.Sum(a.value, b.value);
  }

  public static Number<T> operator -(Number<T> a, Number<T> b)
  {
   return Calculator.Difference(a, b);
  }

  public static bool operator>(Number<T> a, Number<T> b)
  {
   return Calculator.Compare(a, b) > 0;
  }

  public static bool operator <(Number<T> a, Number<T> b)
  {
   return Calculator.Compare(a, b) < 0;
  }

  public static Number<T> operator *(Number<T> a, Number<T> b)
  {
   return Calculator.Multiply(a, b);
  }

  public static Number<T> operator /(Number<T> a, Number<T> b)
  {
   return Calculator.Divide(a, b);
  }

  public static Number<T> operator /(Number<T> a, int b)
  {
   return Calculator.Divide(a, b);
  }
#endregion
 }
}

#if (ASD)
#region DataStructures
namespace DS.Common
{
 public static class Comparers
 {
  public static bool IsNumber<T>(this T value)
  {
   if (value is sbyte)
    return true;
   if (value is byte)
    return true;
   if (value is short)
    return true;
   if (value is ushort)
    return true;
   if (value is int)
    return true;
   if (value is uint)
    return true;
   if (value is long)
    return true;
   if (value is ulong)
    return true;
   if (value is float)
    return true;
   if (value is double)
    return true;
   if (value is decimal)
    return true;
   return false;
  }

  public static bool IsEqualTo<T>(this T firstValue, T secondValue)where T : IComparable<T>
  {
   return firstValue.Equals(secondValue);
  }

  public static bool IsGreaterThan<T>(this T firstValue, T secondValue)where T : IComparable<T>
  {
   return firstValue.CompareTo(secondValue) > 0;
  }

  public static bool IsLessThan<T>(this T firstValue, T secondValue)where T : IComparable<T>
  {
   return firstValue.CompareTo(secondValue) < 0;
  }

  public static bool IsGreaterThanOrEqualTo<T>(this T firstValue, T secondValue)where T : IComparable<T>
  {
   return (firstValue.IsEqualTo(secondValue) || firstValue.IsGreaterThan(secondValue));
  }

  public static bool IsLessThanOrEqualTo<T>(this T firstValue, T secondValue)where T : IComparable<T>
  {
   return (firstValue.IsEqualTo(secondValue) || firstValue.IsLessThan(secondValue));
  }
 }

 public static class Helpers
 {
  public static void Swap<T>(this IList<T> list, int firstIndex, int secondIndex)
  {
   if (list.Count < 2 || firstIndex == secondIndex)
    return;
   var temp = list[firstIndex];
   list[firstIndex] = list[secondIndex];
   list[secondIndex] = temp;
  }

  public static string PadCenter(this string text, int newW, char fillerCharacter = ' ')
  {
   if (string.IsNullOrEmpty(text))
    return text;
   int length = text.Length;
   int cTP = newW - length;
   if (cTP < 0)
    throw new AE("New w must be greater than string length.");
   int pL = cTP / 2 + cTP % 2;
   int pR = cTP / 2;
   StringBuilder rB = new StringBuilder(newW);
   for (int i = 0; i < pL; i++)
    rB.Insert(i, fillerCharacter);
   for (int i = 0; i < length; i++)
    rB.Insert(i + pL, text[i]);
   for (int i = newW - pR; i < newW; i++)
    rB.Insert(i, fillerCharacter);
   return rB.ToString();
  }

  public static void Populate<T>(this T[, ] array, int rows, int columns, T defaultValue = default (T))
  {
   for (int i = 0; i < rows; ++i)
   {
    for (int j = 0; j < columns; ++j)
    {
     array[i, j] = defaultValue;
    }
   }
  }
 }
}

namespace DS.Dictionaries
{
}

namespace DS.Graphs
{
}

namespace DS.Hashing
{
}

namespace DS.Heaps
{
 public interface IMaxHeap<T>
  where T : System.IComparable<T>
 {
  int Count
  {
   get;
  }

  bool IsEmpty
  {
   get;
  }

  void Initialize(System.Collections.Generic.IList<T> newCollection);
  void Add(T heapKey);
  T Peek();
  void RemoveMax();
  T ExtractMax();
  void Clear();
  void RebuildHeap();
  T[] ToArray();
  System.Collections.Generic.List<T> ToList();
  IMinHeap<T> ToMinHeap();
 }

 public interface IMinHeap<T>
  where T : System.IComparable<T>
 {
  int Count
  {
   get;
  }

  bool IsEmpty
  {
   get;
  }

  void Initialize(System.Collections.Generic.IList<T> newCollection);
  void Add(T heapKey);
  T Peek();
  void RemoveMin();
  T ExtractMin();
  void Clear();
  void RebuildHeap();
  T[] ToArray();
  System.Collections.Generic.List<T> ToList();
  IMaxHeap<T> ToMaxHeap();
 }
}

namespace DS.Lists
{
 public class ArrayList<T> : IEnumerable<T>
 {
  bool DefaultMaxCapacityIsX64 = true;
  bool IsMaximumCapacityReached = false;
  public const int MAXIMUM_ARRAY_LENGTH_x64 = 2146435071;
  public const int MAXIMUM_ARRAY_LENGTH_x86 = 134217728;
  private readonly T[] _emptyArray = new T[0];
  private const int _defaultCapacity = 8;
  private T[] _collection;
  private int _size
  {
   get;
   set;
  }

  public ArrayList(): this (capacity: 0)
  {
  }

  public ArrayList(int capacity)
  {
   if (capacity < 0)
   {
    throw new ArgumentOutOfRangeException();
   }
   else if (capacity == 0)
   {
    _collection = _emptyArray;
   }
   else
   {
    _collection = new T[capacity];
   }

   _size = 0;
  }

  private void _ensureCapacity(int minCapacity)
  {
   if (_collection.Length < minCapacity && IsMaximumCapacityReached == false)
   {
    int newCapacity = (_collection.Length == 0 ? _defaultCapacity : _collection.Length * 2);
    int maxCapacity = (DefaultMaxCapacityIsX64 == true ? MAXIMUM_ARRAY_LENGTH_x64 : MAXIMUM_ARRAY_LENGTH_x86);
    if (newCapacity < minCapacity)
     newCapacity = minCapacity;
    if (newCapacity >= maxCapacity)
    {
     newCapacity = maxCapacity - 1;
     IsMaximumCapacityReached = true;
    }

    this._resizeCapacity(newCapacity);
   }
  }

  private void _resizeCapacity(int newCapacity)
  {
   if (newCapacity != _collection.Length && newCapacity > _size)
   {
    try
    {
     Array.Resize<T>(ref _collection, newCapacity);
    }
    catch (OutOfMemoryException)
    {
     if (DefaultMaxCapacityIsX64 == true)
     {
      DefaultMaxCapacityIsX64 = false;
      _ensureCapacity(newCapacity);
     }

     throw;
    }
   }
  }

  public int Count
  {
   get
   {
    return _size;
   }
  }

  public int Capacity
  {
   get
   {
    return _collection.Length;
   }
  }

  public bool IsEmpty
  {
   get
   {
    return (Count == 0);
   }
  }

  public T First
  {
   get
   {
    return _collection[0];
   }
  }

  public T Last
  {
   get
   {
    return _collection[Count - 1];
   }
  }

  public T this[int index]
  {
   get
   {
    return _collection[index];
   }

   set
   {
    _collection[index] = value;
   }
  }

  public void Add(T dataItem)
  {
   if (_size == _collection.Length)
   {
    _ensureCapacity(_size + 1);
   }

   _collection[_size++] = dataItem;
  }

  public void AddRange(IEnumerable<T> elements)
  {
   if (elements == null)
    throw new ArgumentNullException();
   if (((uint)_size + elements.Count()) > MAXIMUM_ARRAY_LENGTH_x64)
    throw new OverflowException();
   if (elements.Any())
   {
    _ensureCapacity(_size + elements.Count());
    foreach (var element in elements)
     this.Add(element);
   }
  }

  public void AddRepeatedly(T value, int count)
  {
   if (count < 0)
    throw new ArgumentOutOfRangeException();
   if (((uint)_size + count) > MAXIMUM_ARRAY_LENGTH_x64)
    throw new OverflowException();
   if (count > 0)
   {
    _ensureCapacity(_size + count);
    for (int i = 0; i < count; i++)
     this.Add(value);
   }
  }

  public void InsertAt(T dataItem, int index)
  {
   if (_size == _collection.Length)
   {
    _ensureCapacity(_size + 1);
   }

   if (index < _size)
   {
    Array.Copy(_collection, index, _collection, index + 1, (_size - index));
   }

   _collection[index] = dataItem;
   _size++;
  }

  public bool Remove(T dataItem)
  {
   int index = IndexOf(dataItem);
   if (index >= 0)
   {
    RemoveAt(index);
    return true;
   }

   return false;
  }

  public void RemoveAt(int index)
  {
   _size--;
   if (index < _size)
   {
    Array.Copy(_collection, index + 1, _collection, index, (_size - index));
   }

   _collection[_size] = default (T);
  }

  public void Clear()
  {
   if (_size > 0)
   {
    _size = 0;
    Array.Clear(_collection, 0, _size);
    _collection = _emptyArray;
   }
  }

  public void Resize(int newSize)
  {
   Resize(newSize, default (T));
  }

  public void Resize(int newSize, T defaultValue)
  {
   int currentSize = this.Count;
   if (newSize < currentSize)
   {
    this._ensureCapacity(newSize);
   }
   else if (newSize > currentSize)
   {
    if (newSize > this._collection.Length)
     this._ensureCapacity(newSize + 1);
    this.AddRange(Enumerable.Repeat<T>(defaultValue, newSize - currentSize));
   }
  }

  public void Reverse()
  {
   Reverse(0, _size);
  }

  public void Reverse(int startIndex, int count)
  {
   if (count < 0 || startIndex > (_size - count))
   {
    throw new ArgumentOutOfRangeException();
   }

   Array.Reverse(_collection, startIndex, count);
  }

  public void ForEach(Action<T> action)
  {
   if (action == null)
   {
    throw new ArgumentNullException();
   }

   for (int i = 0; i < _size; ++i)
   {
    action(_collection[i]);
   }
  }

  public bool Contains(T dataItem)
  {
   if ((Object)dataItem == null)
   {
    for (int i = 0; i < _size; ++i)
    {
     if ((Object)_collection[i] == null)
      return true;
    }
   }
   else
   {
    EqualityComparer<T> comparer = EqualityComparer<T>.Default;
    for (int i = 0; i < _size; ++i)
    {
     if (comparer.Equals(_collection[i], dataItem))
      return true;
    }
   }

   return false;
  }

  public bool Contains(T dataItem, IEqualityComparer<T> comparer)
  {
   if (comparer == null)
   {
    throw new ArgumentNullException();
   }

   if ((Object)dataItem == null)
   {
    for (int i = 0; i < _size; ++i)
    {
     if ((Object)_collection[i] == null)
      return true;
    }
   }
   else
   {
    for (int i = 0; i < _size; ++i)
    {
     if (comparer.Equals(_collection[i], dataItem))
      return true;
    }
   }

   return false;
  }

  public bool Exists(Predicate<T> searchMatch)
  {
   return (FindIndex(searchMatch) != -1);
  }

  public int FindIndex(Predicate<T> searchMatch)
  {
   return FindIndex(0, _size, searchMatch);
  }

  public int FindIndex(int startIndex, Predicate<T> searchMatch)
  {
   return FindIndex(startIndex, (_size - startIndex), searchMatch);
  }

  public int FindIndex(int startIndex, int count, Predicate<T> searchMatch)
  {
   if (count < 0 || startIndex > (_size - count))
   {
    throw new ArgumentOutOfRangeException();
   }

   if (searchMatch == null)
   {
    throw new ArgumentNullException();
   }

   int endIndex = startIndex + count;
   for (int index = startIndex; index < endIndex; ++index)
   {
    if (searchMatch(_collection[index]) == true)
     return index;
   }

   return -1;
  }

  public int IndexOf(T dataItem)
  {
   return IndexOf(dataItem, 0, _size);
  }

  public int IndexOf(T dataItem, int startIndex)
  {
   return IndexOf(dataItem, startIndex, _size);
  }

  public int IndexOf(T dataItem, int startIndex, int count)
  {
   if (count < 0 || startIndex > (_size - count))
   {
    throw new ArgumentOutOfRangeException();
   }

   return Array.IndexOf(_collection, dataItem, startIndex, count);
  }

  public T Find(Predicate<T> searchMatch)
  {
   if (searchMatch == null)
   {
    throw new ArgumentNullException();
   }

   for (int i = 0; i < _size; ++i)
   {
    if (searchMatch(_collection[i]))
    {
     return _collection[i];
    }
   }

   return default (T);
  }

  public ArrayList<T> FindAll(Predicate<T> searchMatch)
  {
   if (searchMatch == null)
   {
    throw new ArgumentNullException();
   }

   ArrayList<T> matchedElements = new ArrayList<T>();
   for (int i = 0; i < _size; ++i)
   {
    if (searchMatch(_collection[i]))
    {
     matchedElements.Add(_collection[i]);
    }
   }

   return matchedElements;
  }

  public ArrayList<T> GetRange(int startIndex, int count)
  {
   if (count < 0 || startIndex > (_size - count))
   {
    throw new ArgumentOutOfRangeException();
   }

   var newArrayList = new ArrayList<T>(count);
   Array.Copy(_collection, startIndex, newArrayList._collection, 0, count);
   newArrayList._size = count;
   return newArrayList;
  }

  public T[] ToArray()
  {
   T[] newArray = new T[Count];
   if (Count > 0)
   {
    Array.Copy(_collection, 0, newArray, 0, Count);
   }

   return newArray;
  }

  public List<T> ToList()
  {
   var newList = new List<T>(this.Count);
   if (this.Count > 0)
   {
    for (int i = 0; i < this.Count; ++i)
    {
     newList.Add(_collection[i]);
    }
   }

   return newList;
  }

  public string ToHumanReadable(bool addHeader = false)
  {
   int i = 0;
   string listAsString = string.Empty;
   string preLineIndent = (addHeader == false ? "" : "\t");
   for (i = 0; i < Count; ++i)
   {
    listAsString = String.Format("{0}{1}[{2}] => {3}\r\n", listAsString, preLineIndent, i, _collection[i]);
   }

   if (addHeader == true)
   {
    listAsString = String.Format("ArrayList of count: {0}.\r\n(\r\n{1})", Count, listAsString);
   }

   return listAsString;
  }

  public IEnumerator<T> GetEnumerator()
  {
   for (int i = 0; i < Count; i++)
   {
    yield return _collection[i];
   }
  }

  System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
  {
   return this.GetEnumerator();
  }
 }
}

namespace DS.Trees
{
}

#endregion
#region Algorithms
namespace AL.Common
{
}

namespace AL.Graphs
{
}

namespace AL.Numeric
{
}

namespace AL.Sorting
{
 public static class QuickSorter
 {
  public static void QuickSort<T>(this IList<T> collection, Comparer<T> comparer = null)
  {
   int startIndex = 0;
   int endIndex = collection.Count - 1;
   comparer = comparer ?? Comparer<T>.Default;
   collection.InternalQuickSort(startIndex, endIndex, comparer);
  }

  private static void InternalQuickSort<T>(this IList<T> collection, int leftmostIndex, int rightmostIndex, Comparer<T> comparer)
  {
   if (leftmostIndex < rightmostIndex)
   {
    int wallIndex = collection.InternalPartition(leftmostIndex, rightmostIndex, comparer);
    collection.InternalQuickSort(leftmostIndex, wallIndex - 1, comparer);
    collection.InternalQuickSort(wallIndex + 1, rightmostIndex, comparer);
   }
  }

  private static int InternalPartition<T>(this IList<T> collection, int leftmostIndex, int rightmostIndex, Comparer<T> comparer)
  {
   int wallIndex, pivotIndex;
   pivotIndex = rightmostIndex;
   T pivotValue = collection[pivotIndex];
   wallIndex = leftmostIndex;
   for (int i = leftmostIndex; i <= (rightmostIndex - 1); i++)
   {
    if (comparer.Compare(collection[i], pivotValue) <= 0)
    {
     collection.Swap(i, wallIndex);
     wallIndex++;
    }
   }

   collection.Swap(wallIndex, pivotIndex);
   return wallIndex;
  }
 }
}
#endregion
#endif

using System;

namespace CF_SchoolQueue {
    class Program {
        static void Main(string[] args) {
            string[] input = Console.ReadLine().Split();
            int time = Int32.Parse(input[1]);
            string queue = Console.ReadLine();
            string outputqueue = string.Empty;
            for(int i = 0; i < time; ++i) {
                for(int j = 0; j < (queue.Length-1); ++j) {
                    if((queue[j] == 'B') && (queue[j+1] == 'G')){
                        outputqueue += "GB";
                        ++j;
                    } else {
                        outputqueue += queue[j];
                    }
                }
            }
            Console.WriteLine(outputqueue);
        }
    }
}

using System;

namespace B._Queue_at_the_School
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] line = Console.ReadLine().Split(' ');
            int second = Convert.ToInt32(line[1]);
            string data = Console.ReadLine();
            string result = data;

            while (second != 0)
            {
                second--;
                data = result;
                result = "";

                for (int i = 0; i < data.Length - 1; i++)
                {
                    if (data[i] == 'B' && data[i + 1] == 'G')
                    {
                        result += "GB";
                        i++;
                    }
                    else result += data[i];
                }
                if (data[data.Length - 1] == 'B') result += 'B';
            }

            Console.WriteLine(result);
        }
    }
}

using System;
using System.Linq;
using System.Text;

namespace _266B
{
    class Program
    {
        static void Main()
        {
                var t = Console.ReadLine().Split().Select(int.Parse).ToArray()[1];
                string queue = Console.ReadLine();
                for (int i = 1; i <= t; i++)
                {
                    queue.Replace("BG", "GB");
                }
                Console.WriteLine(queue);
        }
    }
}

using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] numbers = Array.ConvertAll(Console.ReadLine().Split(' '), Int32.Parse);
            char[] pupils = Console.ReadLine().ToCharArray();
            bool inCircle = false;
            for(int i=0;i<=numbers[1];i++)
            {
                for (int j = 0; j < numbers[0]-1; j ++)
                {
                    if (pupils[j] == 'B' && pupils[j + 1] == 'G')
                    {
                        inCircle = true;
                        pupils[j] = 'G';
                        pupils[j + 1] = 'B';
                        j++;
                    }
                }
                if (inCircle)
                {
                    i++;
                    inCircle = false;
                }
            }
            foreach (char i in pupils)
            {
                Console.Write(i);
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void move(int[] num)
        {
            for (int i = 0; i <num.Length-1; i++)
            {
                if (num[i] == 1 && num[i + 1] == 0)
                {
                    num[i] = 0;
                    num[i + 1] = 1;
                }
            }
        }
        static void Main(string[] args)
        {
            int n = 0, t = 0;
            string s = Console.ReadLine();
            for (int i = 0; i < s.Length; i++)
            {
                if (s[i] == ' ')
                {
                    n = int.Parse(s.Substring(0, i));
                    t = int.Parse(s.Substring(i + 1));
                    break;
                }
            }
            s = Console.ReadLine();
            int[] num = new int[n];
            for (int i = 0; i < n; i++)
            {
                if (s[i] == 'B')
                    num[i] = 1;
            }
            for (int i = 0; i < t; i++)
                move(num);
            for (int i = 0; i < num.Length; i++)
            {
                if (num[i] == 0)
                    Console.Write("G");
                else
                    Console.Write("B");
            }
            Console.WriteLine();
            //BBGGBG
            //BGBGGB
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace code
{
    class Wight
    {

        static void Main(string[] args)
        {

            string[] lines = new string[2];

            for(int i=0; i<lines.Length;i++)
            {
                lines[i]= Console.ReadLine();
            }

           string[] counts = lines[0].Split(' ');

            int count= Convert.ToInt16(counts[0]);

            int index= Convert.ToInt16(counts[1]);

            char[]queue=   lines[1].ToCharArray();

            List<char> newqueu = new List<char>();

            int c = 0;
            for (int i = queue.Length-1; i >= 0; i--)
            {
               if(c!=index)
                {
                    if(queue[i]=='G')
                    {
                        newqueu.Add('G');
                    }

                    else if (queue[i-1] == 'G' && queue[i]=='B')
                    {
                        queue[i - 1] = 'B';
                        queue[i] = 'G';
                        newqueu.Add('G');
                    }
                    c++;
                }

            }

           for(int j=0; j<newqueu.Count;j++)
            {

                Console.Write(newqueu[j]);
            }

           for(int j= 0; j<count-newqueu.Count;j++)
            {
                Console.Write(queue[j]);
            }

          /* for( int j=0; j<newqueu.Length; j++)
            {
                Console.Write(newqueu[j]);
            }*/

            Console.WriteLine();

        }
    }
}

using System;

namespace Очередь_в_школе
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] nt = Console.ReadLine().Split();
            int n = Convert.ToInt32(nt[0]);
            int t = Convert.ToInt32(nt[1]) + 1;
            string lineString = Console.ReadLine();
            char[] lineMas = new char[n];
            for (int i = 0; i < lineString.Length; i++)
            {
                lineMas[i] = Convert.ToChar(lineString[i]);
            }
            int count = 0;
            for (int i = 0; i < n - 1; i++)
            {

                if (lineMas[i] == 'B' && lineMas[i + 1] == 'G' && count < t)
                {
                    lineMas[i] = 'G';
                    lineMas[i + 1] = 'B';
                    count++;
                }
                if (count == t)
                {
                    break;
                }
            }
            for (int i = 0; i < lineMas.Length; i++)
            {
                Console.Write(lineMas[i]);
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CodeForces
{
    public class Test
    {
        public static void Main()
        {
            int[] arr = Array.ConvertAll(Console.ReadLine().Split(' '), x => Convert.ToInt32(x));
            int n = arr[0];
            int t = arr[1];
            string queueLine = Console.ReadLine();
            StringBuilder r = new StringBuilder(queueLine);
            while (t > 0)
            {
                for (int i = 0; i < n - 1; i++)
                {
                    if (r[i] == 'B' && r[i + 1] == 'G')
                    {
                        r[i] = 'G';
                        r[i + 1] = 'B';
                        i = i + 2;
                    }
                    else
                    {
                        r[i] = r[i];
                    }
                }
                t--;
            }
            Console.WriteLine(r);
        }
    }

}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ACM
{
    class Program
    {
        static void Main(string[] args)
        {
            //while (true)
            {
                #region A. Boy or Girl
                ///*

                // wjmzbmr

                // */
                //int Notdistinct = 0;

                //string Name = Console.ReadLine();
                //for (int i = 0; i < Name.Length; i++)
                //{
                //    //Console.WriteLine(i);
                //    for (int j = i+1; j < Name.Length; j++)
                //    {
                //        //Console.WriteLine(j);
                //        //Console.WriteLine(Name[i] + "===" + Name[j]);
                //        if (Name[i]==Name[j])
                //        {
                //            Notdistinct++;
                //            //Console.WriteLine(Notdistinct);

                //        }

                //    }

                //}
                ////Console.WriteLine( Name.Length +"-"+Notdistinct+"=" +(Name.Length - Notdistinct) );

                ////Console.WriteLine("Result%2="+(Name.Length - Notdistinct) % 2);

                //if ((Name.Length-Notdistinct)%2==0)
                //{
                //    if ((Name.Length - Notdistinct)<0)
                //    {
                //        Console.WriteLine("IGNORE HIM!");
                //    }
                //    else
                //    {
                //        Console.WriteLine("CHAT WITH HER!");
                //    }

                //}
                //else
                //{

                //    Console.WriteLine("IGNORE HIM!");

                //}

                #endregion

                #region Queue at the School
                string[] tokens = Console.ReadLine().Split();

                int n = int.Parse(tokens[0]);
                int t1 = 0;
                 int t = int.Parse(tokens[1]);
                char []  Temp =new char[50] ;
                string x="";

                string Quee = Console.ReadLine();
                for (int i = 0; i < n; i++)
                {
                    Temp[i] = Quee[i];

                }

                //while (true)
                //{
                //    try
                //    {
                //        if (Temp[t1] == Convert.ToChar("B"))
                //        {
                //            if (Temp[t1 + 1] == Convert.ToChar("G"))
                //            {
                //                Temp[t1] = Convert.ToChar("G");
                //                Temp[t1 + 1] = Convert.ToChar("B");
                //                t1++;
                //            }

                //        }
                //        t1++;
                //        if (t1 >= Quee.Length)
                //        {
                //            break;
                //        }
                //    }
                //    catch (Exception)
                //    {

                //        throw;
                //    }

                // }
                for (int ij = 0; ij < t; ij++)
                {
           for (int i = 0; i < n; i++)
            {
                if (Temp[i] == Convert.ToChar("B"))
                {
                    if (Temp[i + 1] == Convert.ToChar("G"))
                    {
                        Temp[i] = Convert.ToChar("G");
                        Temp[i + 1] = Convert.ToChar("B");
                        i++;
                    }
                }

            }
                }

            Console.Write(Temp );

                #endregion

              //  Console.ReadKey();
            }

        }

    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace code
{
    class Wight
    {

        static void Main(string[] args)
        {

            string[] lines = new string[2];

            for(int i=0; i<lines.Length;i++)
            {
                lines[i]= Console.ReadLine();
            }

           string[] counts = lines[0].Split(' ');

            int count = Convert.ToInt16(counts[0]);

         char[]queue=   lines[1].ToCharArray();

            for(int j=count-1;j>=0;j--)
            {
                Console.Write(queue[j]);
            }

            Console.WriteLine();

        }
    }
}

using System;
using System.Linq;
using System.Text;

namespace _266B
{
    class Program
    {
        static void Main()
        {
                var t = Console.ReadLine().Split().Select(int.Parse).ToArray()[1];
                string queue = Console.ReadLine();
                string x = Console.ReadLine();
                for (int i = 1; i <= t; i++)
                {
                    queue.Replace("BG", "GB");
                }
                Console.WriteLine(queue);
        }
    }
}

using System;

class Program
{
	static void Main()
	{
		string[] inputNum = Console.ReadLine().Split();
		int lengthQue = int.Parse(inputNum[0]);
		int timeStep = int.Parse(inputNum[1]);

		string strQue = Console.ReadLine();
		char[] que = strQue.ToCharArray();

		for (int i = que.Length - 1; i >= 0; i--)
		{
			if (que[i] == 'B' || que[i] == 'b')
			{
				MoveToEnd(i, timeStep, que);
			}
		}

		strQue = new String(que);
		Console.WriteLine(strQue);
	}

	private static void MoveToEnd(int indexChar, int steps, char[] que)
	{
		for (int i = indexChar; (i < que.Length - 1 && steps-- > 0); i++)
		{
			if (que[i + 1] == 'B' || que[i + 1] == 'b')
			{
				break;
			}
			char temp = que[i + 1];
			que[i + 1] = que[i];
			que[i] = temp;
		}
	}
}

using System;

class Program
{
	static void Main()
	{
		string[] inputNum = Console.ReadLine().Split();
		int lengthQue = int.Parse(inputNum[0]);
		int timeStep = int.Parse(inputNum[1]);

		string strQue = Console.ReadLine();
		char[] que = strQue.ToCharArray();

		for (int i = que.Length - 1; i >= 0; i--)
		{
			if (que[i] == 'B')
			{
				MoveToEnd(i, timeStep, que);
			}
		}

		strQue = new String(que);
		Console.WriteLine(strQue);

		Console.ReadLine();
	}

	private static void MoveToEnd(int indexChar, int steps, char[] que)
	{
		for (int i = indexChar; (i < que.Length - 1 && steps-- > 0); i++)
		{
			if (que[i + 1] == 'B')
			{
				break;
			}
			char temp = que[i + 1];
			que[i + 1] = que[i];
			que[i] = temp;
		}
	}
}

using System;
using System.Collections.Generic;
using System.Text;

namespace ACM
{
	class Program
	{
		static void Main(string[] args)
		{
			string[] s = Console.ReadLine().Split(new char[]{' '}, StringSplitOptions.RemoveEmptyEntries);
			int n = int.Parse(s[0]);
			int k = int.Parse(s[1]);

			string r = Console.ReadLine();
			List<int> boys = new List<int>();
			for (int i = 0; i < n; i++)
				if (r[i] == 'B')
					boys.Add(i);

			int q = Math.Max(boys[boys.Count - 1], n - 1);
			for (int j = 0; j < k; j++)
				for (int i = 0; i < boys.Count; i++)
					if (boys[i] < q)
						boys[i]++;

			r = "";
			for (int i = 0; i < n; i++)
				if (boys.Contains(i))
					r += 'B';
				else
					r += 'G';
			Console.WriteLine(r);

			//Console.ReadKey();
		}
	}
}

using System;

class Program
{
	static void Main()
	{
		string[] inputNum = Console.ReadLine().Split();
		int lengthQue = int.Parse(inputNum[0]);
		int timeStep = int.Parse(inputNum[1]);

		string strQue = Console.ReadLine();
		char[] que = strQue.ToCharArray();

		for (int i = 0; i < timeStep; i++)
		{
       for(int j = que.Length-1; j >= 0; j--)
       {
            if (que[i] == 'B')
			{
				MoveToEnd(i, 1, que);
			}
       }
		}

		strQue = new String(que);
		Console.WriteLine(strQue);

		Console.ReadLine();
	}

	private static void MoveToEnd(int indexChar, int steps, char[] que)
	{
		for (int i = indexChar; (i < que.Length - 1 && steps-- > 0); i++)
		{
			if (que[i + 1] == 'B')
			{
				break;
			}
			char temp = que[i + 1];
			que[i + 1] = que[i];
			que[i] = temp;
		}
	}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace codeforces
{
    class Queue_at_the_School
    {
        static void Main(string[] args)
        {
            string a = Console.ReadLine();
            int n = int.Parse(a.Substring(0, a.IndexOf(' ')));
            int t = int.Parse(a.Substring(a.IndexOf(' ') + 1, a.Length - a.IndexOf(' ') - 1));
            int help = t;
            string b = Console.ReadLine(), c = "";
            for (int i = 0; i < n; i++)
            {
                help = t;
                if (b[i] == 'B')
                {
                    while (help != 0)
                    {
                        if (i == b.Length - 1)
                        {
                            break;
                        }
                        if (b[i + 1] == 'G')
                        {
                            c += "G";
                            i++;
                            help--;
                        }
                        else
                        {
                            break;
                        }
                    }
                    c += "B";
                }
                else
                {
                    c += "G";
                }
            }
            Console.WriteLine(c);
            //Console.ReadKey();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CodeForces
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ');
            var n = Int32.Parse(input[0]);
            var t = Int32.Parse(input[1]);
            var s = Console.ReadLine().ToArray();

            for (int i = n-2; i >= 0; i--)
            {
                if (s[i] == 'B')
                {
                    var j = i + 1;
                    int step = 0;
                    while (j<n && step < t)
                    {
                        var temp = s[j-1];
                        s[j - 1] = s[j];
                        s[j] = temp;
                        j++;
                        step++;
                    }
                }
            }

            Console.WriteLine(s);

        }

    }
}

using System;
using System.Linq;

class Problem
{
    public static void Main()
    {
        int[] nt = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        int n = nt[0];
        int t = nt[1];

        char[] children = Console.ReadLine().ToCharArray();

        for (int i = 0; i < t; i++)
        {
            for (int j = n - 1; j > 0; j -= 2)
            {
                if (children[j] - children[j - 1] > 0)
                {
                    char temp = children[j];
                    children[j] = children[j - 1];
                    children[j - 1] = temp;
                }
            }

            if (children.Length % 2 != 0)
            {
                if (children[1] - children[0] > 0)
                {
                    char temp = children[1];
                    children[1] = children[0];
                    children[0] = temp;
                }
            }
        }

        Console.WriteLine(string.Join(string.Empty, children));
    }
}

using System;

class Program
{
	static void Main()
	{
		string[] inputNum = Console.ReadLine().Split();
		int lengthQue = int.Parse(inputNum[0]);
		int timeStep = int.Parse(inputNum[1]);

		string strQue = Console.ReadLine();
		char[] que = strQue.ToCharArray();

		for (int i = 0; i < timeStep; i++)
		{
       for(int j = que.Length-1; j >= 0; j--)
       {
            if (que[j] == 'B')
			{
				MoveToEnd(j, 1, que);
			}
       }
		}

		strQue = new String(que);
		Console.WriteLine(strQue);

		Console.ReadLine();
	}

	private static void MoveToEnd(int indexChar, int steps, char[] que)
	{
		for (int i = indexChar; (i < que.Length - 1 && steps-- > 0); i++)
		{
			if (que[i + 1] == 'B')
			{
				break;
			}
			char temp = que[i + 1];
			que[i + 1] = que[i];
			que[i] = temp;
		}
	}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int n = Convert.ToInt32(input[0]),
                t = Convert.ToInt32(input[1]);
            string queue = Console.ReadLine();
            string _queue = queue;
            for(int i = 0; i < t; i ++)
            {
                for(int j = 0; j < n - 1; j ++)
                {
                    if(queue[j] == 'B' && queue[j+1] == 'G')
                    {
                        _queue = queue.Substring(0, j) + "GB" + queue.Substring(j + 2, queue.Length - j - 2);
                    }
                }
                queue = _queue;
            }
            Console.Write(queue);
        }
    }
}

using System;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] p = Console.ReadLine().Split();
            char temp;
            int n = int.Parse(p[0]);
            int t = int.Parse(p[1]);
            char[] s = Console.ReadLine().ToCharArray();
            for (int j = 0; j < t; j++)
            {
                for (int i = 0; i < n - 1; i++)
                {
                    if (s[i] == 'B')
                    {
                        temp = s[i];
                        s[i] = s[i + 1];
                        s[i + 1] = temp;
                        i++;
                    }
                }
            }
            Console.WriteLine(s);
        }
    }
}

using System;

namespace _266_B_Queue_at_the_School
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] token = Console.ReadLine().Split(' ');

            int n = int.Parse(token[0]);
            int t = int.Parse(token[1]);

            string s = Console.ReadLine();
            char[] c = s.ToCharArray();

            for (int i = 0; i < t; i++)
            {
                for (int j = 0; j < n-1; j++)
                {
                    if(c[j] != s[j+1] && c[j] != 'G')
                    {
                        char temp = c[j];
                        c[j] = c[j + 1];
                        c[j + 1] = temp;

                    }
                }
            }

            foreach (var item in c)
            {
                Console.Write(item);
            }
        }
    }
}

using System;
using System.Linq;
using System.Collections.Generic;

namespace MakeCalendar
{
    class MainClass
    {

        static int ReadIntLine()
        {
            return int.Parse(Console.ReadLine());
        }

        static void ReadInt(ref int a)
        {
            a = ReadIntArrayLine()[0];
        }

        static void ReadInts(ref int a, ref int b)
        {
            var x = ReadIntArrayLine();
            a = x[0]; b = x[1];
        }

        static void ReadInts(ref int a, ref int b, ref int c)
        {
            var x = ReadIntArrayLine();
            a = x[0]; b = x[1]; c = x[2];
        }

        static void ReadInts(ref int a, ref int b, ref int c, ref int d)
        {
            var x = ReadIntArrayLine();
            a = x[0]; b = x[1]; c = x[2]; d = x[3];
        }

        static int[] ReadIntArrayLine()
        {
            char[] sep = { ' ' };
            return Console.ReadLine().Split(sep, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();
        }

        static void PrintLn(object obj)
        {
            Console.WriteLine(obj.ToString());
        }

        static void Main(string[] args)
        {

            int n=0, T=0;
            ReadInts(ref n, ref T);

            char[] line = Console.ReadLine().ToArray();

            for (int t = 0; t < T; t++)
            {
                for (int i = 0; i < line.Length-1; i++)
                {
                    if (line[i] == 'B' && line[i + 1] == 'G')
                    {
                        line[i] = 'G';
                        line[i+1] = 'B';
                        i++;
                    }
                }
                PrintLn(new string(line));
            }

            PrintLn(new string(line));

        }
    }
}

using System;
using System.Text;
class test{
    public static void Main(string[] temp){
        int[] NK=Array.ConvertAll(Console.ReadLine().Split(' '),Int32.Parse);
        StringBuilder queue=new StringBuilder(Console.ReadLine());
        for(int i=0;i<NK[1];i++){
            for(int j=1;j<NK[0];j++){
                if(queue[j]=='G'&&queue[j-1]=='B'){
                    queue[j-1]='G';
                    queue[j]='B';
                    }
            }
            Console.WriteLine(queue.ToString());
        }
    }
}

using System;
using System.Linq;
using System.Text;

namespace QueryInCitchen
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] array = Console.ReadLine().Split(' ')
                .Select(int.Parse).ToArray();
            StringBuilder query = new StringBuilder(Console.ReadLine());
            for (int i = 0; i < array[1]; i++)
            {
                for (int j = 0; j < query.Length; j++)
                {
                    try
                    {
                        if (query[j] == 'B' && query[j + 1] == 'G')
                        {
                            char tmp = query[j];
                            query[j] = query[j + 1];
                            query[j + 1] = tmp;
                            j++;
                        }
                    }
                    catch (IndexOutOfRangeException)
                    {
                        continue;
                    }
                }

                Console.WriteLine(query);
            }
        }
    }
}

using System;
using System.Linq;

namespace Codeforces
{
  class Program
  {
    static void Main(string[] args)
    {
      string nt = Console.ReadLine();
      char[] s = Console.ReadLine().ToCharArray();

      int n = Int32.Parse(nt.Split(' ')[0]);
      int t = Int32.Parse(nt.Split(' ')[1]);

      for (int i = 0; i < t; i++)
      {
        for (int j = 0; j < s.Count() - 1; j++)
        {
          if (s[j] == 'B' && s[j + 1] == 'G')
          {
            char tmp = s[j];
            s[j] = s[j + 1];
            s[j + 1] = tmp;
            j += 2;
          }
        }
      }

      Console.WriteLine(new string(s));
    }
  }
}

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace CodeForces
{
	internal class Template
	{
		private static readonly Scanner cin = new Scanner();

		private static void Main()
		{
			//Console.SetIn(new StreamReader(@"C:\CodeForces\input.txt"));
			new Template().Solve();
		}

		private void Solve()
		{
			var len = cin.NextInt();
			var t = cin.NextInt();
			var q = cin.Next().ToCharArray();
			for (var i = 0; i < t; i++)
			{
				for (var j = 1; j < q.Length; j++)
				{
					if (q[j] == 'G' && q[j - 1] == 'B')
					{
						q[j] = 'B';
						q[j - 1] = 'G';
					}
				}
			}
			var res = new string(q);
			Console.WriteLine(res);
		}
	}

	internal class Scanner
	{
		private string[] s = new string[0];
		private int i;
		private readonly char[] cs = new[] { ' ' };

		public string Next()
		{
			if (i < s.Length) return s[i++];
			var line = Console.ReadLine() ?? string.Empty;
			s = line.Split(cs, StringSplitOptions.RemoveEmptyEntries);
			i = 1;
			return s.First();
		}

		public double NextDouble()
		{
			return double.Parse(Next());
		}

		public int NextInt()
		{
			return int.Parse(Next());
		}

		public long NextLong()
		{
			return long.Parse(Next());
		}
	}
}

using System;
class Program
    {
        static void Main(string[] args)
        {
            char[] line;
            int timeOffset;
            int length;
            {
                string[] input = Console.In.ReadToEnd().Split(new char[] { ' ', '\n', '\r', '\t' }, StringSplitOptions.RemoveEmptyEntries);
                line = input[2].ToCharArray();
                timeOffset = int.Parse(input[1]);
                length = int.Parse(input[0]);
            }
            {
                char temp;
                for (int i = 0; i < timeOffset; ++i)
                {
                    for (int j = length - 1; j > 0; --j)
                    {
                        if (line[j] == 'G' && line[j - 1] == 'B')
                         { temp = line[j]; line[j] = line[j - 1]; line[j - 1] = temp; }
                    }
                }
            }
            Console.WriteLine(new string(line));
        }
    }

using System;

namespace Очередь_в_школе
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] nt = Console.ReadLine().Split();
            int n = Convert.ToInt32(nt[0]);
            int t = Convert.ToInt32(nt[1]) + 1;
            string lineString = Console.ReadLine();
            char[] lineMas = new char[n];
            for (int i = 0; i < lineString.Length; i++)
            {
                lineMas[i] = Convert.ToChar(lineString[i]);
            }
            int count = 0;
            for (int i = 0; i < n - 1; i++)
            {

                if (lineMas[i] == 'B' && lineMas[i + 1] == 'G' && count < t)
                {
                    lineMas[i] = 'G';
                    lineMas[i + 1] = 'B';
                    count++;
                }
                if (count == t)
                {
                    break;
                }
            }
            for (int i = 0; i < lineMas.Length; i++)
            {
                Console.Write(lineMas[i]);
            }
        }
    }
}

using System;

class Program
{
	static void Main()
	{
		try
		{
			string[] inputNum = Console.ReadLine().Split();
			int lengthQue = int.Parse(inputNum[0]);
			int timeStep = int.Parse(inputNum[1]);

			if (lengthQue < 1) return;
			if (timeStep > 50) return;

			string strQue = Console.ReadLine();
			char[] que = strQue.Trim().ToUpper().ToCharArray();

			for (int i = que.Length - 1; i >= 0; i--)
			{
				if (que[i] == 'B')
				{
					MoveToEnd(i, timeStep, que);
				}
			}

			strQue = new String(que);
			Console.WriteLine(strQue);
		}
		catch (Exception ex)
		{
			Console.WriteLine(ex.Message);
		}

		Console.ReadLine();
	}

	private static void MoveToEnd(int indexChar, int steps, char[] que)
	{
		for (int i = indexChar; (i < que.Length - 1 && steps-- > 0); i++)
		{
			if (que[i + 1] == 'B')
			{
				break;
			}

			char temp = que[i + 1];
			que[i + 1] = que[i];
			que[i] = temp;
		}
	}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace code
{
    class Wight
    {

        static void Main(string[] args)
        {

            string[] lines = new string[2];

            for(int i=0; i<lines.Length;i++)
            {
                lines[i]= Console.ReadLine();
            }

           string[] counts = lines[0].Split(' ');

            int count = Convert.ToInt16(counts[0]);

            int index= Convert.ToInt16(counts[1]);

            char[]queue=   lines[1].ToCharArray();

            char[] newqueu= new char[count];

            for(int j=count-1;j>=0;j--)
            {

                newqueu[count-1-j] = queue[j];

            }

                for (int m = index; m < count; m++)
                {
                    Console.Write(newqueu[m]);
                }

                for (int f = 0; f < index; f++)
                {
                    Console.Write(newqueu[f]);
                }

            Console.WriteLine();

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
namespace CP
{
    class Program
    {
        static void Main(string [] main)
        {
            int [] nAndT = Array.ConvertAll(Console.ReadLine().Split(' ') , x => Convert.ToInt32(x));
            int n = nAndT[0];
            int t = nAndT[1];
            StringBuilder str = new StringBuilder();
            str.Append(Console.ReadLine());
            for(int i = 0 ; i < t ; i++)
            {
                for(int j = 0 ; j < str.Length - 1 ; j++)
                {
                    if(str[j] == 'B' && str[j+1] == 'G')
                    {
                        str[j+1] = 'B';
                        str[j] = 'G';
                    }
                    j++;
                }
            }
            Console.WriteLine(str);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Xml;

class Program
{
    static void Main(string[] args)
    {
        int[] DATA = Enumerable.Select(Console.ReadLine().Split(' '), x => int.Parse(x)).ToArray();

        int n = DATA[0], t = DATA[1];
        List<char> Info = Console.ReadLine().ToCharArray().ToList();

        int BoyIndexFromInfo = Info.IndexOf('B');
        //BGGBG
        //GGBGB
        while (BoyIndexFromInfo != -1)
        {
            int Counter = 0;
            for (int i = BoyIndexFromInfo+1; i < n; i++)
            {
                if (Info[i] == 'B') break;

                if (Counter >= t) break;
                Counter++;
            }
            var D = Info.GetRange(BoyIndexFromInfo, Counter+1);
            D = D.OrderByDescending(x => (int) x).ToList();

            int u = 0;
            D[D.IndexOf('B')] = '*';
            for (int i = BoyIndexFromInfo; i <= BoyIndexFromInfo+Counter; i++)
            {
                Info[i] = D[u];
                u++;
            }

            BoyIndexFromInfo = Info.IndexOf('B');
        }

        Console.WriteLine(string.Join("", Info).Replace('*','B'));
    }
}

using System;

namespace Codeforces
{
    class Codeforces
    {
        public static void Main(string[] args)
        {
            int time = int.Parse(Console.ReadLine().Split(' ')[1]);

            char[] line = Console.ReadLine().ToCharArray();

            for (int t = 0; t < time; t++)
            {
                for (int i = 1; i < line.Length; i++)
                {
                    if (line[i] == 'B' && line[i - 1] == 'G')
                    {
                        char temp = line[i];

                        line[i] = line[i - 1];
                        line[i - 1] = temp;

                        i += 1;
                    }
                }
            }

            Console.Write(string.Join("", line));
        }
    }
}

using System.Collections.Generic;
using System.Collections;
using System.Text;
using System.Linq;
using System.Threading;
using System.IO;
using System;

namespace round_159
{
    class Program
    {
        public static long ReadLong(){

				return long.Parse(Console.ReadLine());

			}

		public static int ReadInt(){

                return int.Parse(Console.ReadLine());

            }

		public static byte ReadByte(){

                return byte.Parse(Console.ReadLine());

            }

        public static string[] ReadStrArr(){

                return Console.ReadLine().Split(' ');

            }

		public static int[] ReadIntArr(){

				string[] s;
				s=Console.ReadLine().Split(' ');
				int[] a=new int[s.Length];
				for (int i=0;i<s.Length;i++)
				{
					a[i]=int.Parse(s[i]);
				}
				return a;

			}

		public static long[] ReadLongArr(){

				string[] s;
				s=Console.ReadLine().Split(' ');
				long[] a=new long[s.Length];
				for (int i=0;i<s.Length;i++)
				{
					a[i]=long.Parse(s[i]);
				}
				return a;

			}

		public static byte[] ReadByteArr(){

				string[] s;
				s=Console.ReadLine().Split(' ');
				byte[] a=new byte[s.Length];
				for (int i=0;i<s.Length;i++)
				{
					a[i]=byte.Parse(s[i]);
				}
				return a;

			}

        public static double[] ReadDoubleArr(){

				string[] s;
				s=Console.ReadLine().Split(' ');
				double[] a=new double[s.Length];
				for (int i=0;i<s.Length;i++)
				{
					a[i]=double.Parse(s[i]);
				}
				return a;

			}

		public static int findpivot(int[] a,int i,int j){

			for (int k=i+1;k<=j;k++){
				if (a[k]>a[i]) return k;
				else if (a[k]<a[i]) return i;
			}
			return -1;

		}

		public static int partion(int[] a,int i,int j, int pivot){
			int l=i,r=j,tmp;
			while(l<r){
				while ((a[l]<pivot)&&(r>l)) l++;
				while ((a[r]>=pivot)&&(r>l)) r--;
				tmp=a[l];
				a[l]=a[r];
				a[r]=tmp;

			};
			return l;
		}

		public static void quicksort (int[] a, int i,int j){

			int pivotindex=findpivot(a,i,j);
			int k;
			if (pivotindex!=-1) {
				k=partion(a,i,j,a[pivotindex]);
				quicksort(a,i,k-1);
				quicksort(a,k,j);
			}

		}

		public static int findpivot(long[] a,int i,int j){

			for (int k=i+1;k<=j;k++){
				if (a[k]>a[i]) return k;
				else if (a[k]<a[i]) return i;
			}
			return -1;

		}

		public static int partion(long[] a,int i,int j, long pivot){
			int l=i,r=j;
			long tmp;
			while(l<r){
				while ((a[l]<pivot)&&(r>l)) l++;
				while ((a[r]>=pivot)&&(r>l)) r--;
				tmp=a[l];
				a[l]=a[r];
				a[r]=tmp;

			};
			return l;
		}

		public static void quicksort (long[] a, int i,int j){

			int pivotindex=findpivot(a,i,j);
			int k;
			if (pivotindex!=-1) {
				k=partion(a,i,j,a[pivotindex]);
				quicksort(a,i,k-1);
				quicksort(a,k,j);
			}

		}

		public static void Main(string[] args)
        {

			int[] n=ReadIntArr();
			int flag=0;
			string s=Console.ReadLine();
			char[] s1=new char[n[0]];
			for (int i=0;i<s.Length;i++){
				s1[i]=s[i];
			}
			for (int i=0;i<n[1];i++){
				for (int j=1;j<n[0];j++){
						if (flag==1){flag=0;}
						else if ((s1[j-1]=='B')&(s1[j]=='G')){
							s1[j-1]='G';
							s1[j]='B';
							flag=1;
						}
				}
			}
			for (int i=0;i<n[0];i++){
			Console.Write(s1[i]);
			}
			Console.WriteLine();
        }

    }

}

using System;
using System.Linq;

namespace ConsoleApp5
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] data = Console.ReadLine().Split(' ');
            ushort n = Convert.ToUInt16(data[0]), t = Convert.ToUInt16(data[1]);
            string peopl = Console.ReadLine().ToUpper();
            bool flag = false;
            char[] peopls = peopl.ToArray();
            n -= 1;
            while (t!=0)
            {
                for (int i = 0; i < n ; i++)
                {
                    if (peopls[i] == 'B' && peopls[i + 1] == 'G' && !flag)
                    {
                        peopls[i] = 'G';
                        peopls[i + 1] = 'B';
                        flag = true;
                    }
                    else
                        flag = false;
                }
                t--;
            }
            string res = new string(peopls);
            Console.WriteLine(res);

        }
    }
}

using System;
using System.Collections.Generic;
using System.Text;

namespace C0deforces
{
    class QueueAtTheSchool
    {
       static void Main(string[] args)
        {
            int[] NandT = Array.ConvertAll(Console.ReadLine().Trim().Split(' '), int.Parse);
            string[] s = Console.ReadLine().Trim().Split();
            StringBuilder sb = new StringBuilder();
            while (NandT[1]-- > 0)
            {
                for (int i = 0; i < s.Length - 1; i++)
                {
                    if (s[i] == "B" && s[i + 1] == "G") { s[i + 1] = "B"; s[i] = "G"; i++; }
                }
            }
            Console.WriteLine(string.Join("",s));
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp1
{
    class Program
    {
        static void Main()
        {
            List<int> input = ReadInputParseToList();
            List<char> c = new List<char>();
            int n = input[0];
            int time = input[1];
            string s = Console.ReadLine();

            for (int i = 0; i < s.Length; i++)
            {
                c.Add(s[i]);
            }

            for (int t = 0; t < time; t++)
            {
                for (int i = 0; i < n; i++)
                {
                    for (int j = i+1; j < n; j++)
                    {
                        if (c[i] == 'B' && c[j] == 'G')
                        {
                            var temp = c[i];
                            c[i] = c[j];
                            c[j] = temp;
                            i += 2;
                        }
                        else
                        {
                            i++;
                        }
                    }
                }
            }
            Console.WriteLine(string.Join("", c));

        }

        private static List<int> ReadInputParseToList()
        {
            return Console.ReadLine().Split().Select(int.Parse).ToList();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Text;

namespace C0deforces
{
    class QueueAtTheSchool
    {
        static void Main(string[] args)
        {
            int[] NandT = Array.ConvertAll(Console.ReadLine().Trim().Split(' '), int.Parse);
            string s = Console.ReadLine().Trim();
            StringBuilder sb = new StringBuilder();
            while (NandT[1]-- > 0)
            {
                for (int i = 0; i < s.Length - 1; i++)
                {
                    if (s[i] == 'B' && s[i + 1] == 'G') { sb.Append("GB"); i++; }
                    else { sb.Append(s[i]); }
                }
                s = sb.ToString();
                sb.Clear();
            }
            Console.WriteLine(s);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;

namespace codeforces
{
    class Program
    {
        static void Swap(ref List<bool> list, int index)
        {
            bool temp = list[index - 1];
            list[index - 1] = list[index];
            list[index] = temp;
        }
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int n = Convert.ToInt32(input[0]);
            int t = Convert.ToInt32(input[1]);
            List<bool> queue = new List<bool>();
            string queueStr = Console.ReadLine();
            for (int i = 0; i < n; i++)
                queue.Add(queueStr[i] == 'B');
            for (int i = 0; i < t; i++)
            {
                for (int b = 0; b < n; b++)
                    if (queue[b])
                    {
                        for (int g = b; g < n; g++)
                        {
                            b++;
                            if (!queue[g])
                            {
                                Swap(ref queue, g);
                                break;
                            }
                        }
                    }

            }
            queueStr = "";
            for (int i = 0; i < n; i++)
                queueStr += queue[i] ? 'B' : 'G';
            Console.WriteLine(queueStr);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BoyOrGirl
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();

            // if count of dist chars is odd
            char[] array = s.ToCharArray();
            array = array.Distinct().ToArray();
            int countOfDistChars = array.Length;

            if (countOfDistChars % 2 == 0)
            {
                Console.WriteLine("CHAT WITH HER!");
            }
            else
            {
                Console.WriteLine("IGNORE HIM!");
            }

            Console.ReadLine();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {

        int[] DATA = Enumerable.Select(Console.ReadLine().Split(' '), x => int.Parse(x)).ToArray();

        int n = DATA[0], t = DATA[1];
        List<char> Info = Console.ReadLine().ToCharArray().ToList();

        //5 2        BBGBBG  GBBGBB
        int FirstBoyIndex = Info.IndexOf('B');

        while (FirstBoyIndex != -1)
        {
            int currentIndex = FirstBoyIndex; int counter = 0;
            for (int i = currentIndex+1; i < n; i++)
            {
                //if (Info[i] == 'B') break;
                if (counter >= t) break;
                counter++;
            }
            int GotoIndex = currentIndex + counter;

            List<char> Q = Info.GetRange(currentIndex, (counter+1)).OrderByDescending(x => (int)x).ToList();
            int u = 0;
            for (int i = currentIndex; i <= GotoIndex; i++)
            {
                if (Q[u] == 'B') Info[i] = '*';
                else Info[i] = 'G';
                u++;
            }

            //for (int i = GotoIndex; i > currentIndex; i--)
            //{
            //    if (Info[i] == 'G') {
            //        char tmp = Info[i];
            //        Info[i] = Info[i - 1]; Info[i - 1] = tmp;
            //    }
            //}
            //for (int i = 0; i < counter; i++)
            //{
            //    currentIndex = Info.IndexOf('B'); Info[currentIndex] = '*';
            //}
            FirstBoyIndex = Info.IndexOf('B');
        }

        Console.WriteLine(string.Join("",Info).Replace('*','B'));
    }

    private static IEnumerable<string> Permutate(string source)
    {
        if (source.Length == 1) return new List<string> { source };

        var permutations = from c in source
                           from p in Permutate(new String(source.Where(x => x != c).ToArray()))
                           select c + p;

        return permutations;
    }

}

//private static IEnumerable<string> Permutate(string source)
//{
//    if (source.Length == 1) return new List<string> { source };

//    var permutations = from c in source
//                       from p in Permutate(new String(source.Where(x => x != c).ToArray()))
//                       select c + p;

//    return permutations;
//}

using System;
using System.Linq;
using System.Text;

namespace QueryInCitchen
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] array = Console.ReadLine().Split(' ')
                .Select(int.Parse).ToArray();
            StringBuilder query = new StringBuilder(Console.ReadLine());
            for (int i = 0; i < array[1]; i++)
            {
                for (int j = 0; j < query.Length; j++)
                {
                    try
                    {
                        if (query[j] == 'B' && query[j + 1] == 'G')
                        {
                            char tmp = query[j];
                            query[j] = query[j + 1];
                            query[j + 1] = tmp;
                            j++;
                        }
                    }
                    catch (IndexOutOfRangeException)
                    {
                        continue;
                    }
                }

                Console.WriteLine(query);
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;

namespace CSharp_Contests
{
    public class Program
    {
        public static void Main() {
            int x = Console.ReadLine().Split(new char[1] { ' ' }).Select(a => int.Parse(a)).Last();
            char[] childs = Console.ReadLine().ToCharArray();
            StringBuilder result = new StringBuilder(100);
            List<int> b = new List<int>();
            int lastBI = -1, i;/*
5 1
BGGBG
           */
            for (i = childs.Length - 1; i != -1; i--)
            {
                if (childs[i] == 'B')
                {
                    childs[i] = 'G';
                    childs[( lastBI = ( childs.Length - 1 - i > x ) ? i + x : childs.Length - 1 )] = 'B';
                    break;
                }
            }
            if (lastBI != -1)
                for (i = lastBI - 1; i > -1; i--)
                {
                    if (childs[i] == 'B')
                    {
                        childs[i] = 'G';
                        childs[( lastBI = ( lastBI - i > x ) ? i + x : lastBI - 1 )] = 'B';
                    }
                }

            Console.WriteLine(string.Concat(childs));

#if DEBUG
            Console.ReadLine();
#endif
        }
    }
}