題目: 提款卡密碼
import java.util.Scanner;
import java.lang.Math;
public class ATMCard{
public static Scanner sc = new Scanner(System.in);
public static String str;
public static int length,a,b,i;
public static void main(String args[]){
while(sc.hasNext()){
str = sc.nextLine();
length = str.length();
a = (int)(str.charAt(0));
i = 0;
while(++i < length){
b = (int)(str.charAt(i));
System.out.print(Math.abs(a - b));
a = b;
}
System.out.println();
}
}
}
沒有留言:
張貼留言