Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1780    Accepted Submission(s): 635

Problem Description
After Gardon had got Angel's letter, he found it was encoded...Oh my god, why did she encode a love-letter?? But don't worry, she wrote the algorithm for encoding after the letter:
Each charactor are changed to a corresponding charactor. If the keyword is "Angel", the rule will be:

ABCDEFGHIJKLMNOPQRSTUVWXYZ
ANGELZYXWVUTSRQPOMKJIHFDCB

You may find that in the bottom line, charactors of the keyword come first. All other charactors will come in a reversed order.

Now given another keyword, work the letter out!
Can you write a program to translate the letter?

 
Input
The letter will begin with the keyword (All uppercase), then lines of text.
 
Output
Decode the letter and print it out. Please note that a upper-case charactor will be decoded to a upper-case charactor, while a lower-case charactor will be decoded to a lower-case charactor.
 
Sample Input
ANGEL
Fxlr jxaj eac W xlam cqim hqwgl
W xahl kqsl kplgwat zlltwry
Tlj sl atfack jxwru W eqr'j farra zqmylj cqi
W mlslsnlm aj jxl eac
Cqi aml atfack qr sc swre
Lhlrjxqiyx W vikj gar jxwru anqij cqi
Wz jxl eac wr jxl zijiml
Jxwk tqhl fwtt nlgqswry jmil
W'hl rlhlm gxaryl sc swre jxaj W fwtt tqhl cqi zqmlhlm
W eqr'j gaml xqf zqqt wj wk
W fwtt tlj sc emlas gqsl jmil
W fwtt jltt cqi kqsljxwry W farra tlj cqi urqf,W tlj cqi urqf
 
W tqhl cqi, tqhwry cqi, ak jxl sqikl tqhlk jxl mwgl
Lhlr lhlmc eac xak kjqms,W fwtt atfack nc cqim kwel
W swkk cqi, swkkwry cqi
W eqr'j gaml xqf xame wj wk
W vikj farj cqi jq nl xappc
Lhlmcjxwry, W eq wj zqm cqi
 
Sample Output
When that day I hear your voice
I have some special feeling
Let me always think I don't wanna forget you
I remember at the day
You are always on my mind
Eventhough I just can think about you
If the day in the future
This love will becoming true
I've never change my mind that I will love you forever
I don't care how fool it is
I will let my dream come true
I will tell you something I wanna let you know, I let you know
 
I love you, loving you, as the mouse loves the rice
Even every day has storm, I will always by your side
I miss you, missing you
I don't care how hard it is I just want you to be happy
Everything, I do it for you
 #include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
char sh[],s[];
char c;
int i,j,k,l,m,n;
void ac(char sh[])
{
l=strlen(sh);
for(i=;i<l;i++)
if(sh[i]>='a'&&sh[i]<='z')
sh[i]-=;//先变成大写
for(i=;i<l;i++)
s[i]=sh[i];
int flag=;
for(i=;i>=;i--)//得到密码字符串
{
for(j=;j<l;j++)
if('Z'-i==sh[j])
break;
if(j==l)
s[flag--]='Z'-i;
}
}
int main()
{
scanf("%s",sh);
getchar();
ac(sh);
while(scanf("%c",&c)!=EOF)//逐个字母输入
{
for(i=;i<;i++)
{
if(c==s[i])
{
printf("%c",'A'+i);
break;
} if(c==s[i]+)
{
printf("%c",'a'+i);
break;
}
}
if(i==)
printf("%c",c);
}
}

HDU 1591 Encoded Love-letter(简单字符串)的更多相关文章

  1. HDU 5907 Find Q(简单字符串)

    传送门 Description Byteasar is addicted to the English letter 'q'. Now he comes across a string S consi ...

  2. hdu 5059 简单字符串处理

    http://acm.hdu.edu.cn/showproblem.php?pid=5059 确定输入的数是否在(a,b)内 简单字符串处理 #include <cstdio> #incl ...

  3. CF 208A Dubstep(简单字符串处理)

    题目链接: 传送门 Dubstep Time Limit: 1000MS     Memory Limit: 32768 KB Description Vasya works as a DJ in t ...

  4. 第一部分之简单字符串SDS(第二章)

    一,什么是SDS? 1.引出SDSC字符串:c语言中,用空字符结尾的字符数组表示字符串简单动态字符串(SDS):Redis中,用SDS来表示字符串.在Redis中,包含字符串值的键值对在底层都是由SD ...

  5. C 封装一个通用链表 和 一个简单字符串开发库

    引言 这里需要分享的是一个 简单字符串库和 链表的基库,代码也许用到特定技巧.有时候回想一下, 如果我读书的时候有人告诉我这些关于C开发的积淀, 那么会走的多直啊.刚参加工作的时候做桌面开发, 服务是 ...

  6. 1442: Neo 的简单字符串(字符串)

    1442: Neo 的简单字符串 时间限制: 10 Sec 内存限制: 128 MB 提交: 9 解决: 3 统计 题目描述 Neo 给你一系列字符串,请你输出字符串中的不同单词个数以及总单词个数. ...

  7. HDU 1753 大明A+B(字符串模拟,简单题)

    简单题,但要考虑一些细节: 前导0不要,后导0不要,小数长度不一样时,有进位时,逆置处理输出 然后处理起来就比较麻烦了. 题目链接 我的代码纯模拟,把小数点前后分开来处理,写的很繁杂,纯当纪念——可怜 ...

  8. HDU 2672 god is a girl (字符串处理,找规律,简单)

    题目 //1,1,2,3,5,8,13,21,34,55…… //斐波纳契数列 #include<math.h> #include<stdio.h> #include<s ...

  9. HDU——2112HDU Today(SPFA+简单Hash或map+前向星)

    HDU Today Time Limit: 15000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total ...

随机推荐

  1. VisualStudio使用技巧及快捷键

    1. 怎样调整代码排版的格式? 选择:编辑—>高级—>设置文档的格式或编辑—>高级—>设置选中代码的格式. 格式化cs代码:Ctrl+k+f 格式化aspx代码:Ctrl+k+ ...

  2. bzoj 3289: Mato的文件管理 莫队+树状数组

    3289: Mato的文件管理 Time Limit: 40 Sec  Memory Limit: 128 MB[Submit][Status][Discuss] Description Mato同学 ...

  3. String中hashCode方法的线程安全

    class String{ //默认值是0 int hash; public int hashCode() { //将成员变量hash缓存到局部变量 int h = hash; //这里使用的是局部变 ...

  4. css3转盘

    此效果涉及到 : 1. css 画图形 2. css3 动态效果 3. 贝塞尔曲线 用法 <style> .lds-hourglass { display: inline-block; p ...

  5. StartCoroutine 和 StopCoroutine

    我的Unity版本是2017.2.0p4(64-bit) StartCoroutine的两个版本: StartCoroutine(string methodName) StartCoroutine(I ...

  6. Java JDK5新特性-静态导入

    2017-10-31 00:10:50 静态导入格式:import static 包名 ...类名.方法名: 也就说可以直接导入到方法名. 注意: 方法必须是静态的 如果有多个同名的静态方法,容易不知 ...

  7. Java EE、Java SE和Java ME

    Java SE=Java Standard EditionJava EE=Java Enterprise EditionJava ME=Java Mobile Edition SE主要用于桌面程序,控 ...

  8. (GoRails )使用Vue.js制作拖拉list功能(v5-8)

    视频5 改进视觉效果,让list看起来更舒服.新增横向滚动功能. 参考我的trello:https://trello.com/b/BYvCBpyZ/%E6%AF%8F%E6%97%A5%E8%AE%B ...

  9. 问题✅:render json的格式支持。to_json被改成as_json,功能一样

    class StudentsController < ApplicationController def show @student = Student.find(params[:id]) re ...

  10. Confluence 6 LDAP 用户组结构设置

    用户组对象类(Group Object Class) 这是在 LDAP 用户组对象中使用的类的名字.例如: groupOfUniqueNames group 用户组对象过滤器(Group Object ...