#C11679. Magical String Checker

    ID: 41021 Type: Default 1000ms 256MiB

Magical String Checker

Magical String Checker

You are given a string S which is expected to consist of exactly two distinct characters arranged in an alternating pattern. We call such a string magical if it satisfies the following conditions:

  • Condition 1: The string contains exactly two distinct characters.
  • Condition 2: The characters alternate without any consecutive repetition. In other words, if we denote the two characters as \(a\) and \(b\), the string must be of the form \(ababab\ldots\) or \(bababa\ldots\).

For example, ababab is magical, while aaaaab and abcabc are not.

Your task is to implement a program that reads the string from standard input and prints True if the string is magical, or False otherwise.

inputFormat

The input consists of a single line containing a non-empty string S.

\(1 \leq |S| \leq 10^5\)

outputFormat

Output a single line: True if the string is magical according to the above definition, otherwise False.

## sample
ababab
True