链接:

http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5526

Time Limit: 2 Seconds      Memory Limit: 65536 KB


Edward, a poor copy typist, is a user of the Dvorak Layout. But now he has only a QWERTY Keyboard with a broken Caps Lock key, so Edward never presses the broken Caps Lockkey. Luckily, all the other keys on the QWERTY keyboard work well. Every day, he has a lot of documents to type. Thus he needs a converter to translate QWERTY into Dvorak. Can you help him?

The QWERTY Layout and the Dvorak Layout are in the following:

The QWERTY Layout

The Dvorak Layout

Input

A QWERTY document Edward typed. The document has no more than 100 kibibytes. And there are no invalid characters in the document.

Output

The Dvorak document.

Sample Input

  1. Jgw Gqm Andpw a H.soav Patsfk f;doe
  2. Nfk Gq.d slpt a X,dokt vdtnsaohe
  3. Kjd yspps,glu pgld; aod yso kd;kgluZ
  4. 1234567890
  5. `~!@#$%^&*()}"']_+-=ZQqWEwe{[\|
  6. ANIHDYf.,bt/
  7. ABCDEFuvwxyz

Sample Output

  1. Hi, I'm Abel, a Dvorak Layout user.
  2. But I've only a Qwerty keyboard.
  3. The following lines are for testing:
  4. 1234567890
  5. `~!@#$%^&*()+_-={}[]:"'<>,.?/\|
  6. ABCDEFuvwxyz
  7. AXJE>Ugk,qf;

代码:

  1. #include<stdio.h>
  2. #include<string.h>
  3. #include<stdlib.h>
  4. #include<math.h>
  5.  
  6. #define N 100000
  7.  
  8. char s1[] = "_-+=qWwEeRrTtYyUuIiOoPp{[}]SsDdFfGgHhJjKkLl:;'ZzXxCcVvBbNnMm<,>.?/";
  9. char s2[] = "{[}]'<,>.PpYyFfGgCcRrLl?/+=OoEeUuIiDdHhTtNnSs-:;QqJjKkXxBbMmWwVvZz";
  10.  
  11. int main()
  12. {
  13. char s[N], ch='"';
  14.  
  15. while(gets(s))
  16. {
  17. int i;
  18. for(i=; s[i]; i++)
  19. {
  20. int flag=, a;
  21. char ss[];
  22.  
  23. ss[] = s[i];
  24. ss[] = '\0';
  25.  
  26. if(s[i]==ch)
  27. printf("_"), flag = ;
  28. else if(s[i]=='Q')
  29. printf("%c", ch), flag = ;
  30. else if(strstr(s1, ss))
  31. {
  32. a = strstr(s1, ss) - s1;
  33. printf("%c", s2[a]);
  34. flag = ;
  35. }
  36.  
  37. if(flag==) printf("%c", s[i]);
  38. }
  39.  
  40. printf("\n");
  41. }
  42. return ;
  43. }

(字符串 键盘转换)Convert QWERTY to Dvorak -- zoj -- 5526的更多相关文章

  1. 模拟 ZOJ 3878 Convert QWERTY to Dvorak

    题目传送门 /* 模拟:手敲map一一映射,累! 除了忘记读入字符串不能用gets用getline外还是很顺利的AC了:) */ #include <cstdio> #include &l ...

  2. zoj 3878 Convert QWERTY to Dvorak【好坑的模拟】

    Convert QWERTY to Dvorak Time Limit: 2 Seconds      Memory Limit: 65536 KB Edward, a poor copy typis ...

  3. zoj The 12th Zhejiang Provincial Collegiate Programming Contest Convert QWERTY to Dvorak

    http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5502  The 12th Zhejiang Provincial ...

  4. Convert QWERTY to Dvorak

      Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%lld & %llu Submit Status Pract ...

  5. ACM学习历程—ZOJ3878 Convert QWERTY to Dvorak(Hash && 模拟)

    Description Edward, a poor copy typist, is a user of the Dvorak Layout. But now he has only a QWERTY ...

  6. ZOJ Problem Set - 3878 Convert QWERTY to Dvorak

    题目链接: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3878 /* 问题 很有意思的一道题目,纯模拟,注意细节和最后一 ...

  7. linux bash shell:最方便的字符串大小写转换(lowercase/uppercase conversion) (转)

    原文地址:https://blog.csdn.net/10km/article/details/83384145 关于字符串大小写转换,是写 linux 脚本经常干的事儿,所以总想找个方便的方法让我少 ...

  8. JAVA将数字字符串强制转换成整型变量----求参数之和实验代码(附流程图)

    一.设计思想 先将参数个数输出,并利用循环结果将参数逐个输出,再将字符串强制转化成整型,利用循环结构相加求和 二.程序流程图 三.源程序代码 package demo; public class Co ...

  9. Java中不同转换符实现不同数据类型到字符串的转换

    String类的format()方法用于创建格式化的字符串以及连接多个字符串对象.熟悉C语言的同学应该记得C语言的sprintf()方法,两者有类似之处.format()方法有两种重载形式. form ...

随机推荐

  1. myeclipse越来越卡了怎么回事啊?

    去掉拼写检查:windows->preferences->General->Editors->Text Editors->Spelling 将“Enable spell ...

  2. Androoid studio 2.3 AAPT err(Facade for 596378712): \\?\C:\Users\中文文件夹\.android\build-cache

    错误如下: Error:Some file crunching failed, see logs for details Error:Execution failed for task ':app:m ...

  3. C#使用OpcNetApi.dll和OpcNetApi.Com.dll操作OPC

    本人学习了一下.Net,恰好,51自学网,又要用这个.而网上很多VC6,VB6,VB .Net的但,很少C#的.现在研究一下,给出例子: 测试平台,是VS2008,KEPServer,OpcNetAp ...

  4. debian8下pgsql的主备同步热切手动脚本

    9以后,通过流复制直接做 主:192.168.1.111 从:192.168.1.222 需要在postgres帐号下先配置ssh互信,双机都配置 sh-keygen -t rsa ssh-copy- ...

  5. [转][ASP.NET]ASP.NET 预编译网站

    [转自]https://msdn.microsoft.com/zh-cn/library/ms227430(v=vs.80).aspx C:\Windows\Microsoft.NET\Framewo ...

  6. mysql-11元数据

    我的mysql是用docker配置的,服务器状态和服务器配置变量都未设置,报错正常.

  7. Educational Codeforces Round 37-G.List Of Integers题解

    一.题目 二.题目链接 http://codeforces.com/contest/920/problem/G 三.题意 给定一个$t$,表示有t次查询.每次查询给定一个$x$, $p$, $k$,需 ...

  8. Wasserstein距离 和 Lipschitz连续

    EMD(earth mover distance)距离: 在计算机科学与技术中,地球移动距离(EMD)是一种在D区域两个概率分布距离的度量,就是被熟知的Wasserstein度量标准.不正式的说,如果 ...

  9. 关于memcache分布式一致性hash

    consistent hashing 算法早在 1997 年就在论文 Consistent hashing and random trees 中被提出,目前在 cache 系统中应用越来越广泛: 1  ...

  10. 使用phpexcel导出到xls文件的时候出现乱码解决

    <?php include 'global.php'; $ids = $_GET['ids']; $sql = "select * from crm_cost_end where id ...