102121: [AtCoder]ABC212 B - Weak Password

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

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$.

Input

题意翻译

### 题目描述 你有一个 $4$ 位 PIN:$X_1 X_2 X_3 X_4$,可能以 $0$ 开头。如果这个 PIN 满足下列条件,则我们称它为「弱的 PIN」: - $4$ 位数字均相同。 - 对于每个整数 $i$($1 \le i \le 3$),$X_{i+1}$ 紧跟着 $X_i$。在这里,对于每个 $0 \le j \le 8$ 的 $j$,$j+1$ 紧跟着 $j$,并且 $0$ 紧跟着 $9$。 如果给出 PIN 是「弱的 PIN」,则输出 `Weak`;否则输出 `Strong`。 ### 约定 - $0\le X_1, X_2, X_3, X_4 \le 9$ - $X_1,X_2, X_3$ 和 $X_4$ 都是整数。 ### 输入格式 输入从标准输入(stdin)给出,并且遵循以下格式: > $X_1X_2X_3X_4$ ### 输出格式 如果给出的 PIN 是「弱的 PIN」,输出 `Weak`;否则输出 `Strong`。 ### 输入输出样例解释 #### 样例一解释 $4$ 位都为 $7$,满足第一个条件。所以这个 PIN 是「弱的 PIN」。 #### 样例二解释 第 $1$ 位和第 $2$ 位不一样,并且第 $3$ 位不是紧跟着第 $2$ 位的,所以没有条件满足。 #### 样例三解释 注意,$0$ 紧跟着 $9$。

Output

得分:$200$分

问题描述

给你一个$4$位PIN码:$X_1X_2X_3X_4$,它可以以$0$开头。当PIN码满足以下条件之一时,认为它是弱PIN码:

  • 四个数字全部相同。
  • 对于每个满足$1\leq i\leq 3$的整数$i$,$X_{i+1}$跟随$X_i$。在这里,对于每个$0\leq j\leq 8$,$j+1$跟随$j$,并且$0$跟随$9$。

如果给定的PIN码是弱PIN码,打印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$

输出

如果给定的PIN码是弱PIN码,打印Weak;否则,打印Strong


样例输入1

7777

样例输出1

Weak

四个数字都是$7$,满足第一个条件,所以这个PIN码是弱PIN码。


样例输入2

0112

样例输出2

Strong

第一个和第二个数字不同,第三个数字不跟随第二个数字,所以没有条件被满足。


样例输入3

9012

样例输出3

Weak

注意$0$跟随$9$。

加入题单

算法标签: