zzuli OJ 1064: 加密字符

来源:互联网 发布:阿里云香港b区 编辑:程序博客网 时间:2024/04/24 04:23

Description

从键盘输入一批字符,以@结束,按要求加密并输出。

Input

从键盘输入一批字符,占一行,以@结束。

Output

输出占一行 
加密规则: 
1)、所有字母均转换为小写。 
2)、若是字母'a'到'y',则转化为下一个字母。 
3)、若是'z',则转化为'a'。 
4)、其它字符,保持不变。

Sample Input

Kyh520@

Sample Output

lzi520

HINT

Source

#include<stdio.h>#include<ctype.h>int main(){    char ch;    while( ch = getchar(), ch != '@')    {        if(isalpha(ch))        {            ch = tolower(ch); //若是大写字母,则转换为小写字母            if(ch == 'z')                 ch = 'a';            else                ch = ch + 1;        }        putchar(ch);    }    printf("\n");    return 0;}


0 0