import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T
import Data.Bool (bool)

main :: IO ()
main = do
  let
    f :: [Bool] -> (([Bool], Int), ([Bool], Int))
    f = ((,) <$> snd . fst <*> snd) . foldr step ((True, ([], 0)), ([], 0))
      where
        step :: Bool -> ((Bool, ([Bool], Int)), ([Bool], Int)) -> ((Bool, ([Bool], Int)), ([Bool], Int))
        step False ((_, (kt, ki)), m) = ((False, (False : kt, 1 + ki)), m)
        step True ((False, (kt, ki)), m) = ((True, (True : kt, 1 + ki)), m)
        step True ((True, k@(_, ki)), m@(_, mi)) = ((True, ([], 0)), bool k m (ki <= mi))
  t <- map (== 'P') <$> getLine :: IO [Bool]
  let
    ((kt, ki), (mt, mi)) = f t :: (([Bool], Int), ([Bool], Int))
  putStrLn . map (bool 'D' 'P') $ bool kt mt (ki <= mi)

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n
{-# INLINE unsafeTextToInt #-}
