# Password Validation
## Problem Statement
A password validation service classifies passwords as "weak" or "strong" based on a set of specific rules. The service maintains a list of common words to check password strength.
A password $P$ is considered **weak** if any of the following conditions are true:
1. **Common Substring**: $P$ contains a substring that exactly matches any word from the given list of common words. The match must be case-sensitive.
2. **All Digits**: $P$ consists solely of numerical digits ('0'-'9').
3. **Monocase Letters**: $P$ consists solely of uppercase English letters ('A'-'Z') OR solely of lowercase English letters ('a'-'z').
4. **Short Length**: The length of $P$, denoted as $|P|$, is less than 6 characters.
If none of the above conditions are met, the password $P$ is considered **strong**.
Given a list of passwords and a list of common words, your task is to determine whether each password is "weak" or "strong" according to the criteria above.
## Input Format
- The first line contains two space-separated integers, $N$ and $M$, representing the number of passwords and the number of common words, respectively.
- The next $N$ lines each contain a string $P_i$, representing a password.
- The next $M$ lines each contain a string $W_j$, representing a common word.
## Output Format
For each of the $N$ passwords, output "strong" or "weak" on a new line, corresponding to its classification.
## Sample Test Cases
### Sample Input 1
```
5 3
iliketoCoDe
teaMAKEsmehappy
123456789
xYz12
password
coffee
code
happy
```
### Sample Output 1
```
strong
weak
weak
weak
weak
```
## Constraints
- $1 \le N \le 10^3$
- $1 \le M \le 10^5$
- $1 \le |P_i| \le 20$ for all $1 \le i \le N$
- $1 \le |W_j| \le 20$ for all $1 \le j \le M$
- Passwords $P_i$ and common words $W_j$ consist only of English uppercase letters ('A'-'Z'), lowercase letters ('a'-'z'), and digits ('0'-'9').
- Time limit: 1 second
- Memory limit: 256 MB
## Explanation
Let's analyze each password from Sample Input 1:
1. `"iliketoCoDe"`:
* Does not contain `"coffee"`, `"code"`, or `"happy"` as a case-sensitive substring.
* Contains letters and digits, so not all digits.
* Contains both uppercase and lowercase letters, so not monocase.
* Length is 11, which is $\ge 6$.
* Result: **strong**
2. `"teaMAKEsmehappy"`:
* Contains `"happy"` as a case-sensitive substring (from the common words list).
* Result: **weak**
3. `"123456789"`:
* Consists solely of numerical digits.
* Result: **weak**
4. `"xYz12"`:
* Length is 5, which is $< 6$.
* Result: **weak**
5. `"password"`:
* Consists solely of lowercase letters.
* Result: **weak**
Loading problem statement...