-->
当前位置:首页 > 题库

PROGRAMMING:Lurker

Luz5年前 (2021-05-10)题库595
###Task description
```
Countries R and s are in the midst of war. Both sides send spies to each other to sneak into each other's interior and wait for the opportunity.
After going through difficulties and dangers, the R spy Xiao C, who lurks in the s country, finally finds out the coding rules of the s country's military code
1. The original information to be sent by the military of s country is encrypted and then sent on the network. The content of the original information and the encrypted content are composed of capital letters "a" and "Z" (no space and other letters).
2. State s defines the corresponding "secret character" for each letter. The process of encryption is to replace all the letters in the original information with their corresponding "secret words".
3. Each letter only corresponds to a unique "secret word", and different letters correspond to different "secret words"“ The "secret character" can be the same as the original letter.
For example, if the secret word of "a" is "a" and the secret word of "B" is "C" (other letters and secret words are omitted), the original information "ABA" is encrypted as "ACA".
Now, small C has mastered an encrypted message and its corresponding original information sent on the s country network through the internal line. Little c hopes to decipher the military code of s country through this information. The decoding process of small C is as follows: scan the original information, find the corresponding capital letter Y in the encrypted information for the letter X (representing any capital letter) in the original information, and think that y is the secret word of X in the password. This process continues until it stops in one of the following states:
1. After scanning all the information, all 26 letters of "a '-" Z "appeared in the original information and obtained the corresponding" secret words ".
2. After scanning all the information, it is found that a certain (or some) letter does not appear in the original information.
3. During the scanning, it is found that there are obvious contradictions or errors in the information (in violation of the coding rules of s-pass code). For example, the translation of a message "XYZ" into "ABA" violates the rule that "different letters correspond to different secret words".
When little C is so busy that he is in a daze, the headquarters of r country sends a telegram to ask him to translate another encrypted message just intercepted from s country.
Now please help little C: try to decipher the password through the inside information. Then, the encrypted information in the telegram is translated by using the cracked password.
```
###Input format:
```
A total of 3 lines, each line is a string between 1 and 100 in length.
The first line is a piece of encrypted information held by small C.
The second line is the original information corresponding to the encrypted information in line 1.
The third line is the encrypted information that the R command requires small C to translate.
Input data to ensure that all strings are only composed of capital letters' a '-'z', and the length of the first line is equal to that of the second line.
```
###Output format:
```
output
1 line in total.
If there are two or three cases when the password is broken, please output "failed" (without quotation marks, pay attention to the initial capital, other lowercase).
Otherwise, please output the original information after the encrypted information in the telegram is translated by password.
```
###Input example:
```in
AA
AB
EOWIE
```
###Output example:
```out
Failed
```
###Input example:
```in
QWERTYUIOPLKJHGFDSAZXCVBN
ABCDEFGHIJKLMNOPQRSTUVWXY
DSLIEWO
```
###Output example:
```out
Failed
```
###Input example:
```in
MSRTZCJKPFLQYVAWBINXUEDGHOOILSMIJFRCOPPQCEUNYDUMPP
YIZSDWAHLNOVFUCERKJXQMGTBPPKOIYKANZWPLLVWMQJFGQYLL
FLSO
```
###Output example:
```out
NOIP
```
###Tips
Input and output example 1: the letters "a" and "B" in the original information correspond to the same secret word, and output "failed".
Input and output example 2: the letter "Z" does not appear in the original information, and the output "failed".
source
###Title Source
The first question in the improvement group of noip 2009
Note: this topic is selected from openjudge website http://noi.openjudge.cn/ch0107/11/







answer:If there is no answer, please comment