question 54 Strings & Text · easy
Is this username allowed?
The Runtime Q&A site checks a new username before creating the account. The rules are checked in this order, and the first broken rule is reported: at least 3 characters; at most 15 characters; plain ASCII only (every code point below 128); the first character is a letter a–z or A–Z. Print ok if every rule holds, otherwise the message for the first broken rule.
Input
name, the usernamePrints
too short, too long, plain ASCII only, must start with a letter, or okOrderthe rules are checked in the order listed, and only the first problem is printed
Examples
"codermax39" → ok; "jo" → too short; "9lives" → must start with a letterExpected output1 line
- 1ok