#K7151. Special Number Checker
Special Number Checker
Special Number Checker
Given an integer n, determine whether it is a special number. A number is considered special if its digits alternate between odd and even. In other words, if we denote the digits by \(d_1, d_2, \dots, d_k\), then for every adjacent pair (\(d_i, d_{i+1}\)) with \(1 \leq i < k\), the following condition must hold:
\(d_i \bmod 2 \neq d_{i+1} \bmod 2\)
Note that any single-digit number is considered special by definition.
Examples:
- Input: 5 → Output: True
- Input: 11234 → Output: False (Since the first two digits '1' and '1' have the same parity)
- Input: 1234567890 → Output: True
inputFormat
The input consists of a single line containing an integer n (0 ≤ n ≤ 1018).
outputFormat
Output a single line containing either True
or False
depending on whether n is a special number.
5
True