You have probably registered on Internet sites many times. And each time you should enter your invented password. Usually the registration form automatically checks the password's crypt resistance. If the user's password isn't complex enough, a message is displayed. Today your task is to implement such an automatic check.
Web-developers of the company Q assume that a password is complex enough, if it meets all of the following conditions:
the password length is at least 5 characters;
the password contains at least one large English letter;
the password contains at least one small English letter;
the password contains at least one digit.
You are given a password. Please implement the automatic check of its complexity for company Q.
Input
The first line contains a non-empty sequence of characters (at most 100 characters). Each character is either a large English letter, or a small English letter, or a digit, or one of characters: "!", "?", ".", ",", "_".
Output
If the password is complex enough, print message "Correct" (without the quotes), otherwise print message "Too weak" (without the quotes).
Examples
Input
abacaba
Output
Too weak
Input
X12345
Output
Too weak
Input
CONTEST_is_STARTED!!11
Output
Correct
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
We are asked to write a program that reads a password (non-empty sequence of characters up to 100 characters). It can include uppercase letters, lowercase letters, digits, and punctuation characters: "!", "?", ".", ",", "_". The password is considered complex enough if:
length >= 5
at least one uppercase letter
at least one lowercase letter
at least one digit
If all conditions met, print "Correct". Otherwise, print "Too weak".
This is a straightforward problem. Need to parse the input string, check length, and then iterate to check presence of required character types. Since the allowed characters include punctuation, they are ignored for the checks (except they contribute to length). So we just need to check existence of uppercase, lowercase, digit.
Edge cases: The input line may contain spaces? The problem statement says "non-empty sequence of characters". It might contain spaces? It doesn't mention spaces; it says each character is either a large English letter, or a small English letter, or a digit, or one of characters: "!", "?", ".", ",", "_". So spaces are not included. So we can read the entire line as a string. There may be leading/trailing whitespace? Possibly not; but to be safe, we can strip newline, but not trim spaces because spaces are not allowed anyway. Use input().strip()? Actually if there are no spaces, stripping might remove nothing except newline. Using input().strip() might remove leading/trailing spaces if present, but shouldn't be present. However, we should be careful: if the password includes punctuation, they are allowed, but stripping might remove spaces if any. Since spaces are not allowed, we can safely use .strip() to remove newline and possible leading/trailing spaces if any due to formatting. But the input is a single line. Better to use input().rstrip('\n') or simply input() as it includes the trailing newline? input() returns a line without trailing newline. So we can just store s = input().
Then check: if len(s) < 5: print("Too weak") and exit.
(Note: isdigit returns True for digits 0-9. That's fine.)
After loop, if has_upper and has_lower and has_digit: print("Correct") else: print("Too weak").
That's it.
We'll provide a Python solution.
Potential pitfalls: The password may contain characters like "!" etc. That's fine because they are not caught by these checks. Also, uppercase letters are defined as English letters? The problem says "large English letter". So A-Z. isupper() works for any Unicode uppercase, but since input is limited to English letters, it's fine.
We must ensure we handle string of length up to 100, but that's trivial.
Time complexity O(n).
We'll produce code accordingly.
Example:
Input: "abacaba" -> length 7, no uppercase, no digit => Too weak.
Input: "X12345" -> length 6, uppercase yes, but no lowercase => Too weak.
Input: "CONTEST_is_STARTED!!11" -> length? Contains uppercase, lowercase ("i","s"? Actually "CONTEST_is_STARTED!!11": uppercase letters: C O N T E S T (maybe all caps for "CONTEST", then "", then "is" is lowercase? Actually "CONTEST_is_STARTED!!11": after underscore, "is" is lowercase i and s; then "", then "STARTED" uppercase; then "!!11" digits? The "11" are digits. So has upper, lower, digit, length >=5 => Correct.
Edge: password exactly 5 characters meeting criteria: "Ab1!?" -> should be Correct.
Edge: password less than 5: "Ab1" -> Too weak.
Edge: password with only digits and uppercase: "AB12" length4 -> Too weak because length<5 and missing lower. Actually first length fails, so Too weak.
Implementation: after reading input, we check length first to possibly exit early.
We'll produce final answer. ```python
import sys
def main():
s = input().strip() # read password, strip possible surrounding whitespace (shouldn't be present)
code
# condition 1: length at least 5
if len(s) < 5:
print("Too weak")
return
has_upper = False
has_lower = False
has_digit = False
for ch in s:
if ch.isupper():
has_upper = True
elif ch.islower():
has_lower = True
elif ch.isdigit():
has_digit = True
# early exit if all flags are already True
if has_upper and has_lower and has_digit:
break
if has_upper and has_lower and has_digit:
print("Correct")
else:
print("Too weak")