A7117. 判断回文(填空版)
编程题
入门
知识点
题目描述
给定一个仅由小写字母组成的字符串 $s$。如果 $s$ 从左往右读与从右往左读完全相同,则称 $s$ 为回文串。
### 具体例子
- $s=\texttt{a}$:从左读与从右读都是 $\texttt{a}$,因此是回文串。
- $s=\texttt{abba}$:从左读是 $\texttt{abba}$,从右读也是 $\texttt{abba}$,因此是回文串。
- $s=\texttt{abc}$:从左读是 $\texttt{abc}$,从右读是 $\texttt{cba}$,不相同,因此不是回文串。
- $s=\texttt{abca}$:首尾都是 $\texttt{a}$,但去掉首尾得到 $\texttt{bc}$,而 $\texttt{bc}$ 不是回文串,因此 $\texttt{abca}$ 也不是回文串。
请你用**递归函数**判断 $s$ 是否为回文串。
### 具体例子
- $s=\texttt{a}$:从左读与从右读都是 $\texttt{a}$,因此是回文串。
- $s=\texttt{abba}$:从左读是 $\texttt{abba}$,从右读也是 $\texttt{abba}$,因此是回文串。
- $s=\texttt{abc}$:从左读是 $\texttt{abc}$,从右读是 $\texttt{cba}$,不相同,因此不是回文串。
- $s=\texttt{abca}$:首尾都是 $\texttt{a}$,但去掉首尾得到 $\texttt{bc}$,而 $\texttt{bc}$ 不是回文串,因此 $\texttt{abca}$ 也不是回文串。
请你用**递归函数**判断 $s$ 是否为回文串。
输入格式
第一行包含一个字符串 $s$。
输出格式
如果 $s$ 是回文串,输出
Yes;否则输出 No。输入输出样例
输入 #1
abba
输出 #1
Yes
说明/提示
## 数据范围
- $1\le |s|\le 2\times 10^5$
- $s$ 仅由小写字母组成
- $1\le |s|\le 2\times 10^5$
- $s$ 仅由小写字母组成