Logo
(追記) (追記ここまで)

6890번 - Simple Encryption 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB1211069285.981%

문제

One of the simplest ways of coding a message is to do a letter shift.

For example, if you shift the letters in the original message by 5ドル$ then A in your original message becomes F in the coded message. (B $\to$ G, C $\to$ H, …, T $\to$ Y, U $\to$ Z, V $\to$ A, …, Z $\to$ E). To decode the message, you simply need to shift back by the same number.

A slightly trickier encryption uses a keyword to determine the amount of the shift. Suppose you were using the keyword ACT. To encode the message, you take the original message, remove everything but the alphabetic characters, and form the message into a block that has the same width as the keyword. Here is a sample message to encrypt:

BANANA & PEEL

The blocked version of the message is shown below with the keyword ACT as a header.

A C T
B A N
A N A
P E E
L

Now, the message is encoded using a letter shift. However, this time it is not a uniform shift, it will depend upon the keyword letter at the top of the column. If the letter at the top of the column is an A, then the letters in that column are not shifted. If the letter is a B, then the letters in that column shift by 1ドル,ドル and so on. In the example, the letters in the third column will shift by 19ドル$ since the T is the 20ドル$th letter of the alphabet.

The encoded message is:

A C T
B C G
A P T
P G X
L

You will write a program that will accept a keyword and a string to be encoded. The keyword will never have more than 6ドル$ characters. The message will always be given in all uppercase characters.

입력

The first line of input consists of the keyword. The second line of the input is the message to be encoded. The keyword length will never exceed 6ドル$ characters. The total message length also will never exceed 60ドル$ characters.

출력

Output the encoded message on a single line.

제한

예제 입력 1

ACT
BANANA & PEEL

예제 출력 1

BCGAPTPGXL

예제 입력 2

TRICKY
I LOVE PROGRAMMING!

예제 출력 2

BCWXONKFOTKKFZVI

힌트

출처

Olympiad > Canadian Computing Competition & Olympiad > 2004 > CCC 2004 Junior Division 4번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /