

Time Limit: 2 sec / Memory Limit: 1024 MB
配点 : 200 点
問題文
4 桁の暗証番号 X_1X_2X_3X_4 が与えられます。 番号は先頭の桁が 0 であることもあり得ます。 暗証番号は以下のいずれかの条件をみたすとき弱い暗証番号と呼ばれます。
- 4 桁とも同じ数字である。
- 1\leq i\leq 3 をみたす任意の整数 i について、 X_{i+1} が、 X_i の次の数字である。 ただし、 0\leq j\leq 8 について j の次の数字は j+1 であり、 9 の次の数字は 0 である。
与えられた暗証番号が弱い暗証番号ならば Weak
を、そうでないならば Strong
を出力してください。
制約
- 0 \leq X_1, X_2, X_3, X_4 \leq 9
- X_1, X_2, X_3, X_4 は整数である。
入力
入力は以下の形式で標準入力から与えられる。
X_1X_2X_3X_4
出力
与えられた暗証番号が弱い暗証番号ならば Weak
を、そうでないならば Strong
を出力せよ。
入力例 1
7777
出力例 1
Weak
4 桁ともすべて 7 であるため、 1 つめの条件をみたしており、弱い暗証番号です。
入力例 2
0112
出力例 2
Strong
1 桁目と 2 桁目が異なっており、 3 桁目は 2 桁目の次の数字ではないため、どちらの条件もみたしていません。
入力例 3
9012
出力例 3
Weak
9 の次の数字が 0 であることに注意してください。
Score : 200 points
Problem Statement
You are given a 4-digit PIN: X_1X_2X_3X_4, which may begin with a 0. The PIN is said to be weak when it satisfies one of the following conditions:
- All of the four digits are the same.
- For each integer i such that 1\leq i\leq 3, X_{i+1} follows X_i. Here, j+1 follows j for each 0\leq j\leq 8, and 0 follows 9.
If the given PIN is weak, print Weak
; otherwise, print Strong
.
Constraints
- 0 \leq X_1, X_2, X_3, X_4 \leq 9
- X_1, X_2, X_3, and X_4 are integers.
Input
Input is given from Standard Input in the following format:
X_1X_2X_3X_4
Output
If the given PIN is weak, print Weak
; otherwise, print Strong
.
Sample Input 1
7777
Sample Output 1
Weak
All four digits are 7, satisfying the first condition, so this PIN is weak.
Sample Input 2
0112
Sample Output 2
Strong
The first and second digits differ, and the third digit does not follow the second digit, so neither condition is satisfied.
Sample Input 3
9012
Sample Output 3
Weak
Note that 0 follows 9.