#K95332. Valid Code Checker
Valid Code Checker
Valid Code Checker
You are given a string representing a numerical code. The code is considered valid if it meets the following criteria:
- It contains exactly two occurrences of the digit \(6\).
- There is at least one digit between the two \(6\)'s (i.e. the two \(6\)'s are non-adjacent).
- It does not contain the digit \(7\) anywhere.
Your task is to read a single line input from standard input which consists of the code, and output True
if the code is valid according to the conditions above, and False
otherwise.
inputFormat
Input: A single line containing a non-empty string of digits representing the code.
outputFormat
Output: A single line containing either True
or False
based on whether the given code is valid. Note that True
and False
are case-sensitive.
1234569856
True