P23458 [AtCoder] [ARC035A] Takahashi and Palindrome
入门
题目描述

Problem Description

Takahashi had a certain string. At some point, Cat Snuke came and ate some part of the string.

Takahashi wants to know if the original string could have been a palindrome. Please investigate whether it is possible to fill in the eaten characters appropriately to make it a palindrome. Each eaten character can be replaced with any character freely.

Input Format

The input is given from the standard input in the following format:

$ s $

  • The string $s\ (1\ ≦\ \|s\|\ ≦\ 1,000)$ after being eaten by Cat Snuke is given in one line. Here, $\|s\|$ represents the length of the string $ s $.
  • The string $ s $ is guaranteed to consist of lowercase English letters or *. The * represents an eaten character. Other characters represent the original characters of the string.

Output Format

If the original string could have been a palindrome, output YES; otherwise, output NO to the standard output.

Do not forget the trailing newline.

Sample Input and Output

Sample Input #1

ab*

Sample Output #1

YES

Sample Input #2

abc

Sample Output #2

NO

Sample Input #3

a*bc*

Sample Output #3

YES

Sample Input #4

***

Sample Output #4

YES

Notes/Hints

Sample Explanation 1

If * is replaced with a, it becomes aba, so the original string could have been a palindrome.

Sample Explanation 2

abc is not a palindrome.

Sample Explanation 3

If filled in as acbca, it becomes a palindrome.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
ab*
样例输出
YES