UVa 10082 WERTYU

Code:
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    char arr[100]={"`1234567890-=QWERTYUIOP[]\ASDFGHJKL;'ZXCVBNM,./"};
    string str;
    while(getline(cin,str))
    {
        int len=str.size();
        for(int i=0;i<len;i++)
        {
            if(str[i]==' ') cout<<' ';
            else
            {
                for(int j=0;j<50;j++)
                {
                    if(str[i]==arr[j]) cout<<arr[j-1];
                }
            }
        }
        cout<<endl;
    }
    return 0;

}

留言

這個網誌中的熱門文章

Things a Little Bird Told Me: Confessions of the Creative Mind

UVa 12970 Alcoholic Pilots

UVa 483 Word Scramble