#include <stdio.h>
#include <string.h>
char str[1000000];
void solve ( char &ch )
{
if ( '2' <= ch && ch <= '9' )
{
ch--;
return ;
}
switch ( ch )
{
case '-': ch = '0'; break;
case '=': ch = '-'; break;
case '1': ch = '`'; break;
case '0': ch = '9'; break;
case 'W': ch = 'Q'; break;
case 'E': ch = 'W'; break;
case 'R': ch = 'E'; break;
case 'T': ch = 'R'; break;
case 'Y': ch = 'T'; break;
case 'U': ch = 'Y'; break;
case 'I': ch = 'U'; break;
case 'O': ch = 'I'; break;
case 'P': ch = 'O'; break;
case '[': ch = 'P'; break;
case ']': ch = '['; break;
case '\\': ch = ']'; break;
case 'S': ch = 'A'; break;
case 'D': ch = 'S'; break;
case 'F': ch = 'D'; break;
case 'G': ch = 'F'; break;
case 'H': ch = 'G'; break;
case 'J': ch = 'H'; break;
case 'K': ch = 'J'; break;
case 'L': ch = 'K'; break;
case ';': ch = 'L'; break;
case '\'': ch = ';'; break;
case 'X': ch = 'Z'; break;
case 'C': ch = 'X'; break;
case 'V': ch = 'C'; break;
case 'B': ch = 'V'; break;
case 'N': ch = 'B'; break;
case 'M': ch = 'N'; break;
case ',': ch = 'M'; break;
case '.': ch = ','; break;
case '/': ch = '.'; break;
}
}
int main ( )
{
while ( gets ( str ) != NULL )
{
int len = strlen ( str );
for ( int i = 0; i < len; i++ )
{
solve ( str[i] );
}
printf ( "%s\n", str );
}
return 0;
}
题意: 将输入的字符串在键盘上左移一位!Q A Z 还有功能键不考虐!
连接点击打开链接