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

PROGRAMMING:Vigen è Re password

Luz5年前 (2021-05-10)题库534
###Task description
```
Blaise de Vigen, French diplomat in the 16th century è Re designed a multi table cipher encryption algorithm -- Vigen è Re password. Vigen è The encryption and decryption algorithm of re password is simple and easy to use, and it is difficult to decipher. It was widely used by the Confederate army in the American Civil War.
In cryptography, we call the information to be encrypted plaintext, which is represented by M; The encrypted information is called ciphertext, which is represented by C; The key is a parameter, which is the input data in the algorithm of converting plaintext into ciphertext or ciphertext into plaintext, denoted as K.
In Vigen è Re password, the key K is a string of letters, k = k1k2... Kn. When plaintext M = m1m2... Mn, the ciphertext C = C1C2... Cn is obtained, where CI = MI ® Ki, operation ® The rules are as follows:
```
![ Untitled. PNG] (~ / 709b0d32-2cd4-4dff-84c6-20e5d065dca9. PNG)
```
Vigen è Re encryption needs to pay attention to:
one ® The operation ignores the case of the letters involved in the operation and keeps the case of the letters in plaintext M;
2. When the length of plaintext m is greater than that of key K, the key K is reused.
For example, when plaintext M = HelloWorld and key K = ABC, ciphertext C = hfnlpyosnd.
```
![ 2.png](~/c4bb949c-087b-4cd3-baff-cd9d074d66ec.png)
###Input format:
```
Input 2 lines in total.
The first line is a string representing the key K, which is no more than 100 in length and contains only upper and lower case letters. The second line is a string, which represents the encrypted ciphertext. The length is no more than 1000, which only contains uppercase and lowercase letters.
For 100% of the data, the length of the key input is not more than 100, the length of the ciphertext input is not more than 1000, and all of them contain only English letters.
```
###Output format:
```
Output a total of 1 line, a string representing the plaintext corresponding to the input key and ciphertext.
```
###Input example:
```in
CompleteVictory
Yvqgpxaimmklongnzfwpvxmniytm
```
###Output example:
```out
Wherethereisawillthereisaway
```
###Title Source
The first question in the improvement group of noip 2012
Note: this topic is selected from openjudge website http://noi.openjudge.cn/ch0112/08/






answer:If there is no answer, please comment