#1384: how to AC


1652274-5@g.puiching.edu.mo (P6A05何承禧)

School : No School
ID : 2934
IP address : [192.168.120.33]
Last Login :
2024-11-19 10:17:46
a003. 提款卡密碼 -- 板橋高中教學題 | From: [192.168.120.33] | Post Date : 2024-02-04 14:44

#include <iostream>
using namespace std;

int main() {
    string input;
    while (cin >> input) {
        string password = "";
        for (int i = 1; i < 7; i++) {
            int distance = input[i] - input[i - 1];
            password += to_string(abs(distance));
        }
        cout << password << endl;
    }
    return 0;
}
 
ZeroJudge Forum