The resource on the Internet has been very rich, so that we could get almost everything that we need through the Internet. And we can download it using most of the download tools such as 'thunder', 'flashget' and so on.
If you are an active downloader, you may find that some resource's address looks like "thunder://xxxxxx", instead of the normal URL like "http://xxxxx", and for such resource we can only download with 'thunder'.
In fact, the thunder just converts the original address and do some encode operation. The process can be described by the following steps: for a normal URL like "http://www.abc.com/logo.gif"
First add 'AA' and 'ZZ' before and after the URL, and then it becomes "AAhttp://www.abc.com/logo.gifZZ"
Then encode the result with base64 encryption algorithm, so we get "QUFodHRwOi8vd3d3LmFiYy5jb20vbG9nby5naWZaWg=="
At last we add prefix before it: thunder://QUFodHRwOi8vd3d3LmFiYy5jb20vbG9nby5naWZaWg==
The description may be a little long, but I must continue to describe the base64.
To encode an ascii stream in base64, first write the binary stream into bits. Then take 6 bits from the stream in turn, encode these 6 bits into a base64 character according the following table:
That is, translate every 3 bytes into 4 base64 characters. If the original binary stream contains 3k + 1 bytes, where k is an integer, fill last bits using zero when encoding and append '==' as padding. If the original binary stream contains 3k + 2 bytes, fill last bits using zero when encoding and append '=' as padding. No padding is needed when the original binary stream contains 3k bytes.
For example, to encode 'hello' into base64, first write 'hello' as binary bits, that is: 01101000 01100101 01101100 01101100 01101111
Then, take 6 bits in turn and fill last bits as zero as padding (zero padding bits are marked in bold): 011010 000110 010101 101100 011011 000110 111100
They are 26 6 21 44 27 6 60 indecimal. Look up the table above and use corresponding characters: aGVsbG8
Since original binary data contains 1 * 3 + 2 bytes, padding is needed, append '=' and 'hello' is finally encoded in base64: aGVsbG8=
Now comes to the problem, give you a normal URL, you should convert it into the thunder form.
输入描述:
There are multiple test cases.
For each test case:
A string within 40 characters indicates for the original URL.
输出描述:
For each test case, output one line. Stand for the address after convention.
示例1
输入
复制
http://www.abc.com/logo.gif
http://www.hello.com.cn/res.exe
输出
复制
thunder://QUFodHRwOi8vd3d3LmFiYy5jb20vbG9nby5naWZaWg==
thunder://QUFodHRwOi8vd3d3LmhlbGxvLmNvbS5jbi9yZXMuZXhlWlo=