

Time Limit: 2 sec / Memory Limit: 1024 MiB
配点 : 100 点
問題文
高橋くんはゲームで遊んでいます。 このゲームにはワールドが 8 つあり、それぞれのワールドにはステージが 8 つずつあります。 ステージには順番があり、最初のステージは 1 個めのワールドにある 1 個めのステージです。 i 個め (1\le i\le 8) のワールドにある j 個め (1\le j\le 8) のステージの次のステージは、以下のようになっています。
- j\lt8 のとき、次のステージは i 個めのワールドにある j+1 個めのステージです。
- i\lt8,j=8 のとき、次のステージは i+1 個めのワールドにある 1 個めのステージです。
- i=8,j=8 のとき、次のステージはありません。このステージが最後のステージです。
i 個め (1\le i\le 8) のワールドにある j 個め (1\le j\le 8) のステージの名前は i-j です。
たとえば、最初のステージ名は 1-1
で、最後のステージ名は 8-8
です。
高橋くんが現在遊んでいるステージのステージ名 S が与えられるので、次のステージのステージ名を出力してください。
制約
- S はいずれかのステージのステージ名である。
- S は
8-8
ではない。
入力
入力は以下の形式で標準入力から与えられる。
S
出力
次のステージのステージ名を出力せよ。
入力例 1
4-2
出力例 1
4-3
4 個めのワールドの 2 個めのステージの次のステージは、同じワールドの 3 個めのステージです。
入力例 2
1-8
出力例 2
2-1
1-8
は 1 個めのワールドの最後のステージなので、次のステージは 2 個めのワールドの 1 個めのステージです。
入力例 3
3-3
出力例 3
3-4
Score : 100 points
Problem Statement
Takahashi is playing a game. This game has eight worlds, and each world has eight stages. The stages have an order, and the first stage is the 1st stage in the 1st world. The next stage after the j-th stage (1\le j\le 8) in the i-th world (1\le i\le 8) is as follows:
- When j\lt8, the next stage is the (j+1)-th stage in the i-th world.
- When i\lt8,j=8, the next stage is the 1st stage in the (i+1)-th world.
- When i=8,j=8, there is no next stage. This stage is the last stage.
The name of the j-th stage (1\le j\le 8) in the i-th world (1\le i\le 8) is i-j.
For example, the name of the first stage is 1-1
, and the name of the last stage is 8-8
.
Given the stage name S of the stage Takahashi is currently playing, output the stage name of the next stage.
Constraints
- S is the stage name of one of the stages.
- S is not
8-8
.
Input
The input is given from Standard Input in the following format:
S
Output
Output the stage name of the next stage.
Sample Input 1
4-2
Sample Output 1
4-3
The next stage after the 2nd stage in the 4th world is the 3rd stage in the same world.
Sample Input 2
1-8
Sample Output 2
2-1
1-8
is the last stage in the 1st world, so the next stage is the 1st stage in the 2nd world.
Sample Input 3
3-3
Sample Output 3
3-4