若是凉夜已成梦

青春里 总有些事情要努力去做 总有些梦想要拼命去追。


  • 运维

  • 前端

  • 编程

  • 随笔

  • hust-oj

1112: Problem C: WERTYU

发表于 2017-10-06   |   分类于 HUSTOJ   |   阅读次数 1,053

题目描述

Problem C: WERTYU

A common typing error is to place the hands on the keyboard one row to the right of the correct position. So "Q" is typed as "W" and "J" is typed as "K" and so on. You are to decode a message typed in this manner.
Input consists of several lines of text. Each line may contain digits, spaces, upper case letters (except Q, A, Z), or punctuation shown above [except back-quote (`)]. Keys labelled with words [Tab, BackSp, Control, etc.] are not represented in the input. You are to replace each letter or punctuation symbol by the one immediately to its left on the QWERTY keyboard shown above. Spaces in the input should be echoed in the output.

输入

暂无

输出

暂无

样例输入

O S, GOMR YPFSU/

样例输出

I AM FINE TODAY.

参考代码

#include <stdio.h>
char *k = "`1234567890-=QWERTYUIOP[]\ASDFGHJKL;'ZXCVBNM,./";
main() 
{
    int i,c;
    while (EOF != (c = getchar())) 
    {
        for (i=1;k[i] && k[i]!=c;i++);
        if (k[i]) putchar(k[i-1]); else putchar(c);
    }
}

解析

暂无

hustoj

发表评论 取消回复

电子邮件地址不会被公开。 必填项已用*标注

*
*


hoxis wechat
著作权归作者所有
站点更新说明
  • 文章目录
  • 站点概览
若是凉夜已成梦

若是凉夜已成梦

青春里 总有些事情要努力去做 总有些梦想要拼命去追。

1904 日志
6 分类
12 标签
RSS
weibo github twitter facebook

友情链接

Dreams孤独患者 Skip 原站点
© 2017 若是凉夜已成梦
Powered by WordPress | 已运行
Theme By NexT.Mist