ZOJ 3878-convert QWERTY to Dvorak "analog"

Source: Internet
Author: User



Convert QWERTY to Dvorak Time limit: 2 Seconds Memory Limit: 65536 KB

Edward, a poor copy typist, is a user of the Dvorak Layout. But now he had only a QWERTY Keyboard with a broken Caps Lock key, so Edward never presses the broken Caps Lock key. Luckily, all of the other keys in the QWERTY keyboard work well. Every day, he had 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 is in the following:

The QWERTY Layout
The Dvorak Layout
Input

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

Output

The Dvorak document.

Sample Input
JGW Gqm ANDPW a h.soav patsfk f;doenfk gq.d slpt a x,dokt vdtnsaohekjd Yspps,glu pgld; AOD yso kd;kgluz1234567890 ' [Email protected]#$%^&* ()} ']_+-=zqqwewe{[\| Anihdyf.,bt/abcdefuvwxyz
Sample Output
Hi, I ' m Abel, a Dvorak Layout user. But I ' ve only a Qwerty keyboard. The following lines is for testing:1234567890 ' [email protected]#$%^&* () +_-={}[]: ' <>,.? /\| abcdefuvwxyzaxje>ugk,qf;
Problem Solving Ideas:
Direct simulation on the line.
#include <stdio.h> #include <string.h> #include <algorithm>using namespace Std;char map[2000005]; Char xx[]={"-=_+QWERTYUIOP[]QWERTYUIOP{}ASDFGHJKL; Asdfghjkl:\ "ZXCVBNM,./ZXCVBNM<>?"}; Char yy[]={"[]{} ',. pyfgcrl/=\" <>pyfgcrl?+aoeuidhtns-aoeuidhtns_;qjkxbmwvz:qjkxbmwvz "};int main () {while ( Gets (map)!=null {int j;int len=strlen (map), for (int i=0;i<len;i++) {J=0;bool cc=0;while (Xx[j]) {if (Xx[j]==map[i]) { cc=1;printf ("%c", Yy[j]); else{j++;}} if (cc==0) printf ("%c", Map[i]);} printf ("\ n");} return 0;}


ZOJ 3878-convert QWERTY to Dvorak "analog"

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.