Created
August 3, 2014 04:47
-
-
Save yuikns/7492931c34910ff05838 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// for http://fun.coolshell.cn/unix.html | |
#include <stdio.h> | |
#include <string.h> | |
int main() | |
{ | |
char * seq1 = "pvwdgazxubqfsnrhocitlkeymj"; | |
char seq[32] = ""; | |
for(int i = 0 ; i < strlen(seq1) ; i ++) | |
{ | |
seq[seq1[i] - 'a' ] = 'a' + i; | |
} | |
seq[27] = '0'; | |
printf("%s\n",seq); | |
char buff[1024]; | |
while((scanf("%s",buff)) != EOF) | |
{ | |
for(int i = 0 ; i < strlen(buff) ; i ++) | |
{ | |
//printf("[%c]",buff[i]); | |
if(buff[i] >= 'a' && buff[i] <= 'z') | |
{ | |
putchar(seq[buff[i] - 'a']); | |
}else if(buff[i] >= 'A' && buff[i] <= 'Z') | |
{ | |
putchar(seq[buff[i] - 'A'] - 32); | |
}else | |
{ | |
putchar(buff[i]); | |
} | |
} | |
putchar(' '); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment