UVa 11278 - One Handed Typist Solution

#include <iostream>
#include <map>
#include <string>
using namespace std;
int main(){
    string qwert=" `1234567890-=\
    qwertyuiop[]\\\
    asdfghjkl;'\
    zxcvbnm,./~!@#$%^&*()_+\
    QWERTYUIOP{}|\
    ASDFGHJKL:\"\
    ZXCVBNM<>?";
    string dvo=" `123qjlmfp/[]\
    456.orsuyb;=\\\
    789aehtdck-\
    0zx,inwvg'~!@#QJLMFP?{}\
    $%^>ORSUYB:+|\
    &*(AEHTDCK_\
    )ZX<INWVG\"";
    map<char,char> mp;
    for(int i=0;i<qwert.size();i++){
        mp[qwert[i]]=dvo[i];
    }
    string s;
    while(getline(cin,s)){
        for(int i=0;i<s.size();i++)
            cout<<mp[s[i]];
        cout<<endl;
    }
}

Comments