#C7130. Valid Pattern Checker

    ID: 50968 Type: Default 1000ms 256MiB

Valid Pattern Checker

Valid Pattern Checker

You are given a string pattern. A pattern is considered valid if it meets the following conditions:

  1. The pattern is empty, or
  2. The pattern starts with (A) and ends with (C) with exactly one (B) between them.

Formally, a non-empty string (s) is valid if and only if (s = A;B;C). An empty string is also considered valid.

Your task is to determine whether the given pattern is valid.

inputFormat

Input consists of a single line containing the string pattern. The string may be empty.

outputFormat

Output a single line containing either (True) if the pattern is valid, or (False) otherwise.## sample

ABC
True