#C8955. Zigzag String Checker
Zigzag String Checker
Zigzag String Checker
Given a string s, determine whether it is a zigzag string. A zigzag string is defined as a string where uppercase and lowercase letters alternate, starting with an uppercase letter.
Formally, for a string \( s = s_0 s_1 \cdots s_{n-1} \) of length \( n \ge 1 \), the string is considered zigzag if:
[ \begin{cases} s_0 \text{ is an uppercase letter}, \ \text{and for each } i \ge 1:\newline \quad \text{if } i \text{ is odd, then } s_i \text{ is a lowercase letter}, \ \quad \text{if } i \text{ is even, then } s_i \text{ is an uppercase letter}. \end{cases} ]
For example, "AbCdEf" is a zigzag string, but "abcdef" and "aBcDeF" are not. Your task is to implement a program that reads a single line from standard input and prints True
if the input string is a zigzag string, and False
otherwise.
inputFormat
The input consists of a single line containing a non-empty string s composed of English letters.
outputFormat
Output a single line with either True
if the string is a zigzag string according to the definition above, or False
otherwise.
AbCdEf
True