#B2155. Check Valid C Identifier

    ID: 11237 Type: Default 1000ms 256MiB

Check Valid C Identifier

Check Valid C Identifier

Given a non-empty string with no whitespace, determine whether it is a legal C language identifier. The string is guaranteed not to be a reserved word in C.

C language identifiers must satisfy the following conditions:

  1. It is not a reserved word.
  2. It only contains letters, digits, and underscores (_).
  3. It does not begin with a digit.

In mathematical terms, a valid identifier s must match the regular expression:

$$ ^[a-zA-Z_]\\w*$ $$

inputFormat

The input consists of a single line containing a string s without any whitespace characters.

outputFormat

Output 1 if the string is a valid C identifier, otherwise output 0.

sample

valid_identifier
1