#C5380. Lucky Number Checker

    ID: 49023 Type: Default 1000ms 256MiB

Lucky Number Checker

Lucky Number Checker

A lucky number is defined based on the uniqueness of its digits and the uniqueness of every pair of adjacent digits. Given an integer \(n = d_1d_2\ldots d_k\), the number is considered lucky if and only if:

  • All individual digits \(d_i\) (\(1 \leq i \leq k\)) are distinct.
  • All adjacent digit pairs \(d_i d_{i+1}\) (for \(1 \leq i \leq k-1\)) are unique.

For example, if \(n = 1234\), then the digits 1, 2, 3, 4 are distinct and the pairs "12", "23", and "34" are all unique, so it is a lucky number. However, if \(n = 1124\), the digit '1' repeats, making it not lucky.

Your task is to write a program that reads an integer from standard input and determines whether it is a lucky number. The program should output True if the number is lucky, otherwise output False.

inputFormat

The input consists of a single line containing one integer (n) (0 (\leq n)). The number will be provided via standard input (stdin).

outputFormat

Output a single line containing either True or False (without quotes) to standard output (stdout), indicating whether the input number is a lucky number.## sample

1234
True