B - Encoded Love-letter 字符串的处理
Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u
Description
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
Output
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
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
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<cstdio>
#include<string.h>
using namespace std;
char f[]="1ABCDEFGHIJKLMNOPQRSTUVWXYZ";
char f1[];
int ff[];
char str[];
char s[];
int main()
{
int i,j;
int len;
scanf("%s",str);
//puts(str);
getchar();
len=strlen(str);
memset(ff,,sizeof(ff));
memset(f1,,sizeof(f1));
for(i=; i<=len; i++)
{
f1[i]=str[i-];
ff[str[i-]-'A'+]=;
//printf("%d ",ff[str[i-1]-'A'+1]);
}
j=i;
for(i=; i>=; i--)
if(ff[i]==)
{
f1[j++]='A'-+i;
//printf("%c ",f1[j-1]);
}
//printf("%s",f1);
while(gets(s))
{
len=strlen(s);
for(i=;i<len;i++)
{
if(s[i]>='A'&&s[i]<='Z')
{
for(j=;j<=;j++)
if(s[i]==f1[j]) printf("%c",f[j]);
} else if(s[i]>='a'&&s[i]<='z')
{
for(j=;j<=;j++)
if(s[i]-'a'+'A'==f1[j]) printf("%c",f[j]-'A'+'a');
} //else if(s[i]==0) printf("\n");
else printf("%c",s[i]);
}
printf("\n");
} return ;
}
B - Encoded Love-letter 字符串的处理的更多相关文章
- Python基础->for循环、字符串以及元组
python流程控制>for循环.字符串以及元组 学习有关序列的思想.序列:一组有顺序的东西.所有的序列都是由元素组成的,序列中的元素位置是从0开始编号的,最后一个元素的位置是它长度减一. fo ...
- 《think in python》学习-8
字符串 字符串是一个序列,可以用方括号操作符来访问字符串中的单独字符 fruit = 'banana' letter = fruit[1] 方括号中的表达式称为下标 下标从0 开始 任何表达式,包括变 ...
- [Swift]LeetCode917. 仅仅反转字母 | Reverse Only Letters
Given a string S, return the "reversed" string where all characters that are not a letter ...
- php json_encode 返回false
今天用ajax请求不到数据,发现问题出现在最后一句 echo json_encode($data); var_dump(json_encode($data));输出false 使用json_last_ ...
- 12-4 NSString
原文:http://rypress.com/tutorials/objective-c/data-types/nsstring NSString 在本教程的内容可能我们已经看到过很多次了,NSStri ...
- Html5——File、FileReader、Blob、Fromdata对象
File File 接口提供有关文件的信息,并允许网页中的JavaScript访问其内容. File对象可以用来获取某个文件的信息,还可以用来读取这个文件的内容.通常情况下,File对象是来自用户在一 ...
- Spring Boot项目中使用 TrueLicense 生成和验证License(服务器许可)
一 简介 License,即版权许可证,一般用于收费软件给付费用户提供的访问许可证明.根据应用部署位置的不同,一般可以分为以下两种情况讨论: 应用部署在开发者自己的云服务器上.这种情况下用户通过账号登 ...
- 劳动节快乐!手写个核心价值观编码工具 - Python实现
前言 今天是五一劳动节,祝各位无产阶级劳动者节日快乐! 然后来整活分享一些有趣的东西~ 这个小工具是我大学时做着玩的,对于各位接班人来说,12个词的核心价值观这东西,大家都非常熟悉了,这工具可以实现将 ...
- HDU 1591 Encoded Love-letter(简单字符串)
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission( ...
随机推荐
- MVC简单实例
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressi ...
- VirtualProvider (VirtualCube)虚拟立方体
声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...
- python核心编程第六章练习6-11
6-11.转换.(a)创建一个从整型到IP地址的转换,如下格式:www.xxx.yyy.zzz.(b)更新你的程序,使之可以逆转换.[答案](a)代码如下: Input_number = abs(in ...
- 《高级Web应用程序设计》课程学习资料
任务1:什么是ASP.NET MVC 1.1 ASP.NET MVC简介 1.2 认识ASP.NET MVC项目结构 1.3 ASP.NET MVC生命周期 任务2:初识ASP.NET MVC项目开 ...
- (37) 在命令行调用API
l 前言 有时为了更好地调整和改动数据会和到cli ,这会给我们带来更高的效率,基于官网的文档很是简单,这里就带大家一起运用 cli l 搭建 在项目下面有文件odoo.py 这个文件 ,对就是用这个 ...
- 解决Linux下Tomcat日志目录下的catalina.log日志文件过大的问题
本文摘自:(http://blog.csdn.net/stevencn76/article/details/6246162) 分类: Java技术专区2011-03-13 12:25 5017人阅读 ...
- ListView.DragEnter触发不了
经过千百度的搜索之后,终于找到了一点线索,原文是:https://msdn.microsoft.com/en-us/magazine/mt185571.aspx 有能力的可以参阅原文,想省事的可以等待 ...
- 二分图最大权最小权完美匹配模板KM
在网上找了一份挺好的模板,先标一下哦~链接君:http://blog.csdn.net/abcjennifer/article/details/5844579 #include <iostrea ...
- Python (1) - 7 Steps to Mastering Machine Learning With Python
Step 1: Basic Python Skills install Anacondaincluding numpy, scikit-learn, and matplotlib Step 2: Fo ...
- Octopus系列之代码备份
代码 $.extend($.validator.messages, { required: "This field is required.", remote: "Ple ...