|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||128 MB||35||2||2||5.714%|
Rookie Pirate Captain Jack Albatross has secretly laid anchor in a hidden bay not far from Port Wine, the local meeting point for grizzled pirates and denizens of the sea. Disguising as a messenger, you have infiltrated the service of the dreaded legendary Captain Stevie, and you are entrusted with carrying small encrypted messages between Captain Stevie and his staff of shipmates. Your task is to break the encryption of the messages in aid of young Captain Albatross, giving him a much needed edge in his quest for peg-legged fame. Fortunately, you (in contrast to Captain Albatross) have been around for a while and you’ve come to know what words to expect in written pirate messages. The following is a table of words having common occurrences:
“be” “our” “rum” “will” “dead” “hook” “ship” “blood” “sable” “avenge” “parrot” “captain”
In a (mixed alphabet) substitution cipher, each letter of the plain text is replaced with another, in this case arbitrary but unique, letter from the alphabet. Given a text encrypted with a substitution cipher and the given set of the twelve known words above, your task is to decode the encrypted text and provide us and Captain Albatross with the plain text. This can be accomplished if and only if there is a unique substitution mapping from the encrypted letters to plain text letters such that
Note that not all the known words may be present in the plain text and that replacements are not mutual (’a’ being encrypted by ’h’ does NOT necessarily mean that ’h’ is encrypted by ’a’).
A text encrypted by a substitution cipher.
The encrypted text is given on one line containing at most 200 characters from the set [’a’-’z’,’ ’]. Only the letters [’a’-’z’] of the plain text are encrypted, the spaces are kept unencrypted.
The decrypted plain text if possible, or the string “Impossible” if the text cannot be uniquely decrypted using the set of known words.
ex eoii jpxbmx cvz uxju sjzzcn jzz
we will avenge our dead parrot arr
dyd jkl cs