UVa 10082 Wertyu (Water ver.)

Source: Internet
Author: User
Tags time limit

10082-wertyu

Time limit:3.000 seconds

Http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem &problem=1023

A Common typing the hands on the keyboard one row to the right of the correct position. So "Q" are typed as "W" and "J" is typed as "K" and ".". You are are to decode a message typed into this manner.

Input consists of several lines of text. Each line could 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 are to replace the "one" or "punction" by the "one immediately to" left on the QWERTY keyboard shown above. Spaces in the input should is echoed in the output.

Sample Input

O S, Gomr ypfsu/

Output for Sample Input

I AM FINE today.

Complete code:

/*0.013s*/
  
#include <cstdio>
const char s[] = "' 1234567890-=qwertyuiop[]\\asdfghjkl; ' Zxcvbnm,./";
  
int main (void)
{
    char C;
    int i;
    while (~ (c = GetChar ()))
    {for
        (i = 1; s[i] && s[i]!= C; i++)
            ;
        Putchar (S[i]? S[i-1]: c);
    }
    return 0;
}

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/sjjg/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.