{"problem":{"name":"AB Palindrome","description":{"content":"You are given a string $S$ of length $N$ consisting of `A` and `B`. You can repeat the following operation zero or more times: *   choose a pair of adjacent characters in $S$ and replace them with `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":"arc145_a"},"statements":[{"statement_type":"Markdown","content":"You are given a string $S$ of length $N$ consisting of `A` and `B`.\nYou can repeat the following operation zero or more times:\n\n*   choose a pair of adjacent characters in $S$ and replace them with `AB`.\n\nDetermine whether $S$ can be turned into a palindrome.\nWhat is a palindrome? A string $T$ is a palindrome if and only if, for every integer $i$ ($1 \\le i \\le |T|$), the $i$\\-th character from the beginning and the $i$\\-th character from the end are the same, where $|T|$ is the length of $T$.\n\n## Constraints\n\n*   $2 \\leq N \\leq 2\\times 10^5$\n*   $S$ is a string of length $N$ consisting of `A` and `B`.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$\n$S$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc145_a","tags":[],"sample_group":[["3\nBBA","Yes\n\nReplacing the $2$\\-nd and $3$\\-rd characters, `BA`, with `AB` will turn $S$ into `BAB`, a palindrome."],["4\nABAB","No\n\nNo sequence of operations can turn $S$ into a palindrome."]],"created_at":"2026-03-03 11:01:14"}}