Butterfly

khepa98 Intra AUST Programming Co...
Limits 1s, 512 MB

A string is a butterfly string if it has a 0 at the middle of the string and at both sides of 0 there are exactly the same number of positive length of characters and all the characters are same. For a given string of size, n determine if it is a butterfly string or not.

Input

Input starts with n the size of the string and at the second line, there will be a string of size n consisting of uppercase English letters, lowercase English letters, and digits.

1 ≤ n ≤ 100

Output

If the given string is a butterfly string print “YES” else “NO” ( without quotation signs ) in a single line

Sample

InputOutput
5
YY0YY
YES

Submit

Login to submit.

Statistics

81% Solution Ratio
Uosmoy383Earliest, Aug '21
steinumFastest, 0.0s
steinumLightest, 5.5 kB
ADRI0777Shortest, 187B
Toph uses cookies. By continuing you agree to our Cookie Policy.