#K44387. Check CamelCase Format

    ID: 27520 Type: Default 1000ms 256MiB

Check CamelCase Format

Check CamelCase Format

In this problem, you are given a string and you need to determine whether it follows the CamelCase convention. According to the CamelCase rules for this problem, the string must satisfy the following conditions:

  1. The string must not be empty.
  2. The first character must be a lowercase letter.
  3. For every uppercase letter in the string, its preceding character must be a lowercase letter.

For example, the string helloWorld is valid, while HelloWorld or aBBc are not. In mathematical terms, if we denote the input string by (s), then the following condition must hold: [ \begin{cases} s \neq \emptyset, \ \text{and } s[0]\in{a,b,c,\dots,z}, \quad \forall i\ (1 \leq i < |s|),; \text{if } s[i] \text{ is uppercase then } s[i-1] \in {a,b,c,\dots,z}. \end{cases} ] Your task is to implement a solution that reads the string from standard input and prints 1 if the string is in valid CamelCase format, or 0 otherwise.

inputFormat

The input consists of a single line containing a string. The string should be processed from standard input (stdin).

outputFormat

Output a single integer to the standard output (stdout): 1 if the string follows the CamelCase format, or 0 otherwise.## sample

helloWorld
1