AcWing 767. 信息加密 - Java
原题链接
简单
作者:
KYCygni
,
2021-03-18 03:12:22
,
所有人可见
,
阅读 298
Java 代码
import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
Scanner cin = new Scanner(System.in);
String s = cin.nextLine();
char[] sa = s.toCharArray();
for (int i = 0; i < sa.length; i ++)
{
char x = sa[i];
if (x == 'z')
sa[i] = 'a';
if (x == 'Z')
sa[i] = 'A';
if ( (x >= 'a' && x < 'z') || (x >= 'A' && x < 'Z'))
sa[i] = (char)((int)x + 1);
}
System.out.println (String.valueOf(sa));
}
}