Mock CCC '18 Contest 3 J2 - A Palindrome Problem

View as PDF

Submit solution


Points: 3 (partial)
Time limit: 1.0s
Memory limit: 1G

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

Given a string, determine if it can be partitioned into two nonempty substrings, both of which are palindromes.

Constraints

1 \le N \le 8

The only letters that appear are a and b.

Input Specification

The input consists of a single string of length N.

Output Specification

If the string can be partitioned into two nonempty substrings, both of which are palindromes, output YES.

Output NO otherwise.

Sample Input

a

Sample Output

NO

Sample Input

aa

Sample Output

YES

Comments

There are no comments at the moment.