405250: GYM101858 B Battle Sequence

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

B. Battle Sequencetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

You are one of the $$$1000$$$ lucky people invited to test Sword Art Online closed beta.

The game is very unique and extremely beautiful. But it's still a game.

While battling Illfang, the Kobold Lord, you recognize some attack patterns:

  • Illfang only have two attacks, Chop and Slice.
  • If Illfang uses the same attack $$$3$$$ times in a row, just before the third attack it stops to charge.
  • If Illfang is attacked during it's charge, it does not continue that attack.

Knowing these patterns you came up with an strategy to defeat it:

  • Every time Illfang uses a Chop attack, you will defend with a Block.
  • Every time Illfang uses a Slice attack, you will Dash.
  • If Illfang begins to charge a Chop, you will attack with Plunge.
  • If Illfang begins to charge a Slice, you will attack with Tackle.

Your guild gathered information about the attack sequence of Illfang and your job is to determine your attack sequence to defeat it.

Input

The only line of input contains one string $$$s$$$ ($$$|s| \le 100$$$) — Illfang's attack sequence. 'C' means Illfang will use a Chop attack. 'S' means Illfang will use a Slice attack.

Output

Print one string — your attack sequence to defeat Illfang. 'B' means you will use a Block. 'D' means you will use a Dash. 'P' means you will use a Plunge. 'T' means you will use a Tackle.

ExamplesInput
CSCCCS
Output
BDBBPD
Input
CCSSSSSSC
Output
BBDDTDDTB

Source/Category

加入题单

算法标签: