(明碼及密碼字元一定都在ASCII碼中可列印的範圍內)
輸入:
Olss^vysk
輸出:
HellWorld
import java.util.Scanner;
public class Password {
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
String str;
StringBuffer sb;
while(sc.hasNext()){
str = sc.nextLine();
sb = new StringBuffer();
for(int i = 0; i < str.length(); i++){
sb.append((char)(str.charAt(i) - 7));
}
System.out.println(sb);
}
}
}
沒有留言:
張貼留言