eolymp
bolt
Спробуйте наш новий інтерфейс для відправки розв'язків
Задачі

Coin Turning Game

Coin Turning Game

\includegraphics{https://static.e-olymp.com/content/54/546de69477abf4d72119722e6082020f924e7f0c.jpg} Alice and Bob are playing the following game (Alice plays first): They start with an arrangement of \textbf{N} coins in a row (some of them showing heads and some of them showing tails) At each player's turn, they can flip any number of consecutive coins but the rightmost one has to go from head to tail. Whoever is unable to make a move loses. Given the initial arrangement of coins, if both Alice and Bob play optimally, can Alice win the game? \InputFile First line of the input contains an integer \textbf{T} (\textbf{1} ≤ \textbf{T} ≤ \textbf{100}) - the number of test cases. Each test case consist of a single line containing a string \textbf{S} (\textbf{3} ≤ \textbf{|S|} ≤ \textbf{15}) - the initial arrangement of coins. Each character of \textbf{S} will be either '\textbf{H}' or '\textbf{T}' (telling us if heads or tails are up). \OutputFile For each test case determine if Alice can win the game if both she and Bob play optimally. If she can, print "\textbf{YES}" followed by two integers - the position of the rightmost coin flipped (\textbf{1}-based) and the number of coins flipped. If there are several initial moves with which Alice wins the game, you can print any of them. If Alice cannot win the game, just print "\textbf{NO}" for that test case.
Ліміт часу 1 секунда
Ліміт використання пам'яті 64 MiB
Вхідні дані #1
3
TTTT
HTHT
HTTH
Вихідні дані #1
NO
NO
YES 4 2
Автор Darko Aleksic
Джерело ACM ICPC CCPC 2013