#CT0000075. Mật khẩu an toàn (Secure Passwords)
Bài tập này chưa được xếp vào lộ trình.
Mục lục đề ⌄
Mật khẩu an toàn (Secure Passwords)
Secure Passwords
Version: Phuoc Hung OJ Extended
Problem Statement
You are given a string consisting only of English letters (A–Z, a–z) and digits (0–9).
A password is a contiguous substring of . It is secure if all the following requirements hold:
- It contains at least characters.
- It contains at least one uppercase English letter.
- It contains at least one lowercase English letter.
- It contains at least one digit.
Substrings with different starting or ending positions are counted separately, even if their contents are identical.
Count the total number of contiguous substrings that are secure passwords.
Input
One line containing the string .
Output
Output one integer: the number of secure passwords.
Subtasks
- Subtask 1 (30 points): ; every character belongs to
A–Z,a–z, or0–9. - Subtask 2 (30 points): ; every character belongs to
A–Z,a–z, or0–9. - Subtask 3 (40 points): ; every character belongs to
A–Z,a–z, or0–9.
Examples
Example 1
Input
ABC123abc
Output
3
Explanation: The string has 9 characters. Both length-8 substrings ABC123ab and BC123abc include uppercase, lowercase, and a digit; the length-9 substring also qualifies. Shorter substrings do not.
Example 2
Input
aaaBBB111
Output
3
Explanation: The two length-8 substrings aaaBBB11 and aaBBB111, and the full length-9 string, satisfy all three character requirements.
Example 3
Input
Abcdef12
Output
1
Explanation: The entire string has length 8 and contains A, lowercase letters, and digits 1, 2. Only the whole string is long enough.
Liên quan
Trong các cuộc thi sau: