{"problem":{"name":"Tricolor Pyramid","description":{"content":"We have $N$ blocks arranged in a row, where each block is painted blue, white, or red. The color of the $i$\\-th block from the left $(1 \\leq i \\leq N)$ is represented by a character $c_i$; `B`, `W`, a","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc117_c"},"statements":[{"statement_type":"Markdown","content":"We have $N$ blocks arranged in a row, where each block is painted blue, white, or red. The color of the $i$\\-th block from the left $(1 \\leq i \\leq N)$ is represented by a character $c_i$; `B`, `W`, and `R` stand for blue, white, and red, respectively.\nFrom this situation, we will pile up blue, white, and red blocks to make a pyramid with $N$ steps. The following figure shows an example of this:\n\n![image](https://img.atcoder.jp/arc117/92dfa6597ada13a2682a8c41e06d799e.png)\n\nHere, we place blocks one by one from bottom to top as follows:\n\n*   if the two blocks immediately below a position have the same color, we will place there a block of the same color;\n*   if the two blocks immediately below a position have different colors, we will place there a block of the color different from those two colors.\n\nWhat will be the color of the block at the top?\n\n## Constraints\n\n*   $N$ is an integer satisfying $2 \\leq N \\leq 400000$.\n*   Each of $c_1, c_2, \\dots, c_N$ is `B`, `W`, or `R`.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$\n$c_1$$c_2$$\\cdots$$c_N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc117_c","tags":[],"sample_group":[["3\nBWR","W\n\nIn this case, we will pile up blocks as follows:\n\n*   the $1$\\-st and $2$\\-nd blocks from the left in the bottom row are respectively blue and white, so we place a red block on top of it;\n*   the $2$\\-nd and $3$\\-rd blocks from the left in the bottom row are respectively white and red, so we place a blue block on top of it;\n*   the blocks in the $2$\\-nd row from the bottom are respectively red and blue, so we place a white block on top of it.\n\nThus, the block at the top will be white; we should print `W`."],["4\nRRBB","W\n\nIn this case, we will pile up blocks as follows:\n\n*   the $1$\\-st and $2$\\-nd blocks from the left in the bottom row are both red, so we place a red block on top of it;\n*   the $2$\\-nd and $3$\\-rd blocks from the left in the bottom row are respectively red and blue, so we place a white block on top of it;\n*   the $3$\\-rd and $4$\\-th blocks from the left in the bottom row are both blue, so we place a blue block on top of it;\n*   the $1$\\-st and $2$\\-nd blocks from the left in the $2$\\-nd row from the bottom are respectively red and white, so we place a blue block on top of it;\n*   the $2$\\-nd and $3$\\-rd blocks from the left in the $2$\\-nd row from the bottom are respectively white and blue, so we place a red block on top of it;\n*   the blocks in the $3$\\-rd row from the bottom are respectively blue and red, so we place a white block on top of it.\n\nThus, the block at the top will be white; we should print `W`."],["6\nBWWRBW","B\n\nThe figure below shows the final arrangement of blocks. The block at the top will be blue; we should print `B`.\n![image](https://img.atcoder.jp/arc117/333af8ef18ae0a6ce966c46492cb07e6.png)\nNote that this is the case shown as an example in Problem Statement."],["8\nWWBRBBWB","R\n\nThe figure below shows the final arrangement of blocks. The block at the top will be red; we should print `R`.\n![image](https://img.atcoder.jp/arc117/36a2a6777ac49fa0bb43440de385dced.png)"],["21\nBWBRRBBRWBRBBBRRBWWWR","B"]],"created_at":"2026-03-03 11:01:14"}}