joj1064
来源:互联网 发布:淘宝品牌信息怎么写 编辑:程序博客网 时间:2024/05/21 11:27
1064: Caeser Comes Back
Assume you are a spy who is fulfilling a very important task. You have just stole a very important file from enemy's computer. Now you have to send the file to your headquarter by a special equipment. But in order to make safety, you should encode the file before sending it. Because the soldiers of enemy may come at any time, the encode process shouldn't take too much time. Under such situation, the only encode algorithm you could do is Caeser Encode Algorithm.
The Caeser algorithm can be expressed as:
In the encode process, a character is replaced by the 3rd one after it. Here you can assume that the file consists of only 'a' to 'z' and 'A' to 'Z'. So the last 3 characters are replaced by the first 3 characters. For example, consider this string abcdABCDwxyzWXYZ. After the encode process, it becomes defgDEFGzabcZABC. While in the decode process, this algorithm applies reversely.
Input Specification
The input consists of several lines. Each line consists of two strings A and B(at most 80 characters), separated by a space. If A equals to ENCODE, you should encode B while if A equals to DECODE, you should decode B. If A equals to END, that means the end of input, which you shouldn't process. No other values will A equal to except ENCODE, DECODE and END.
Output Specification
For each A=ENCODE or DECODE, you should encode or decode B and output the result on a single line each.
Sample Input
ENCODE abcdENCODE WXYZDECODE zAbCENCODE aAEND
Sample Output
defgZABCwXyZdD
Problem Source: 1st JOJ Cup Online VContest Warmup Problem
This problem is used for contest: 75
Submit / Problem List / Status / Discuss
- joj1064
- JOJ1064: Caeser Comes Back
- 你会做Web上的用户登录功能吗?
- sys_connect_by_path 用法
- joj1085
- android开发视频教材笔记:第一季 1--8课
- 官方aidl 自我理解
- joj1064
- 自主研发搜索引擎,单机500万网页全文索引,任意检索不超过 20毫秒
- emacs23 linum-mode 全局开启
- oracle的表空间、分区表、以及索引的总结
- joj2026
- ajax中文数据传输乱码问题以及zend framework escape()调用
- 作为Web开发人员,我为什么喜欢Google Chrome浏览器
- Ubuntu Linux系统下Gnome桌面快捷配置
- joj1171