UDPC Party
InterviewTime limit1sMemory limit1024 MB
Given a vote string where U and C can be swapped and D and P can be swapped, find which mascots can strictly win the vote.
- Level
Easy3 of 10
- Topics
- Math, Implementation
- Solved
- No attempts yet
Problem
Yoonie, Phoenix, and Dalgu gathered at one place to hold a party celebrating the opening of UDPC! While the guests had fun together, they started arguing over which of the three mascots is the cutest.

UNIST mascot 'Yoonie' - Source: Yooncheesebread
Come on, no matter how you look at it, our Yoonie is the cutest. Look at those tiny horns and charming mane!

POSTECH mascot 'Phoenix' - Source: POSTECH homepage
If we're talking about manes, our Phoenix has one too! It also has cute wings and a tail~

DGIST mascot 'Dalgu' - Source: Terapin Inc. homepage
Isn't our Dalgu obviously the cutest? Its features are adorable, and its chubby body and fish-shaped bread are cute too!
The debate showed no sign of ending. Tired of talking, the participants decided to vote for the cutest mascot. Each participant wrote exactly one of U, D, P, or C on a paper and dropped it into the ballot box. U stands for Yoonie, D for Dalgu, P for Phoenix, and C for abstaining. A mascot wins if its vote count is strictly greater than the vote count of each of the other two mascots.
Voting ended, and the three mascots began counting. The handwriting and orientation varied so much that they could not tell whether some letters were U or C, or D or P, and the count became a mess!

Is it U or C? The answer is UUUU!

Is it D or P? The answer is DPDP!
Given the voting result, find out which mascots could be selected as the cutest when U and C can be swapped, and D and P can be swapped, during counting.
Input
The first line contains the voting result . is a string containing only U, D, P, and C, and its length is greater than and at most .
Output
If Yoonie can be selected, print U. If Dalgu can be selected, print D. If Phoenix can be selected, print P.
Print the letters of all mascots that can be selected, in the order above.
If none of U, D, and P is printed, print C.