Squad
InterviewTime limit2sMemory limit1024 MB
Given two equal-length digit strings a and b, print the string that takes the larger digit at each position.
- Level
Easy2 of 10
- Topics
- String, Implementation
- Solved
- No attempts yet
Statement
Rebels are attacking the Empire again on the planet Hoth, and Darth Vader has decided to send his best clones there. There is only one starship, but there are two squads to crew it. So he plans to merge the two squads into one, keeping only the best clones in the merged squad.
Both squads have the same number of clones. Each clone has one specialty, and no two clones in the same squad share a specialty. The set of specialties in the first squad is the same as the set in the second squad.
To choose the best clones, a card was made for each squad with the scores the clones received at the academy. The cards were filled in as follows:
- A clone that has not been called yet is called from the first squad.
- The clone from the second squad with the same specialty is called.
- The score of the first clone is appended to the right of the first squad's card, and the score of the second clone is appended to the right of the second squad's card.
- This repeats while uncalled clones remain.
A score is a digit from 0 to 9.
After that, for each specialty, the clone whose score is not less than the other's is chosen. A card for the merged squad was then written in the same specialty order as the two original cards. That card was lost, and now it must be reconstructed.
Input
Two lines contain two numbers and of the same length (). is the number written on the first squad's card, and is the number written on the second squad's card. Neither number has leading zeros.
Output
Print the number written on the card of the merged squad on a single line.