XORChic
InterviewTime limit1sMemory limit256 MB
Given an XOR-encrypted string whose first 8 characters decode to "CHICKENS", recover the key and output the original string.
- Level
Easy2 of 10
- Topics
- Implementation, Bit manipulation, String, Brute force
- Solved
- No attempts yet
Problem
Beomgi ran an XOR operation on Yeongsu's file!
Yeongsu's file contained a string S, and S consisted only of uppercase English letters. Running an XOR operation on the file applies the XOR operation to every character of the string the file contains, changing the file's contents.
To use the XOR operation, a key is needed. If S = "ABCD" and key = 10, the string after the XOR operation becomes "KHIN". The ASCII code of "A" is 65, and XORing it with 10 gives 75. ASCII code 75 is "K", so "A" is encrypted to "K", and the remaining characters are handled the same way.
Yeongsu wants to decrypt the file but does not know the value of the key used. Knowing that the first 8 characters of the file always start with "CHICKENS", can he decrypt it back to the original file?
Input
The first line gives the string T after the XOR operation. (10 ≤ length of T ≤ 100)
T consists only of printable characters.
Output
On the first line, print the string S from before the XOR operation was performed.