#C4429. Lucky Palindromic Number Checker
Lucky Palindromic Number Checker
Lucky Palindromic Number Checker
You are given two inputs, an integer n which represents the length of a number, and an integer number. Your task is to determine whether number is a lucky palindromic number.
A lucky palindromic number satisfies the following conditions:
- The number is palindromic, i.e. it reads the same backwards as forwards.
- Every digit in the number is either
3
or8
.
Output YES
if the number meets both conditions and NO
otherwise.
Note: Although n denotes the intended length of the number, you only need to check the palindromicity and allowed digit criteria.
inputFormat
The input consists of a single line containing two space-separated values:
- An integer n representing the length of the number.
- An integer number which is the number to be checked.
All input should be read from stdin.
outputFormat
Output a single line with YES
if the given number is a lucky palindromic number; otherwise, output NO
. The output should be written to stdout.
3 838
YES