Description
time limit per test : 1 secondtimelimitpertest:1second
memory limit per test : 128 megabytesmemorylimitpertest:128megabytes
给出一个由字符 ‘b’,‘d’,‘p’,‘q’ 构成的字符串 S,判断 S 是不是镜像字符串。镜像字符串指 S 经过以下操作后得到的字符串仍为 S :
- 反转 SS ((例:“bdpq” ⇒ “qpdb” ))
- 将 ‘b’ 改为 ‘d’,‘d’ 改为 ‘b’,’p‘ 改为 ‘q’,’q‘ 改为 ’p‘
Input
一行一个字符串 S(len(S)≤10^3)。
Output
若SS为镜像字符串,输出 YES,否则输出 NO。
Sample Input 1
pbdq
Sample Output 1
YES
Sample Input 2
ppqb
Sample Output 2
NO
思路:
1.先判断字符串长度是否是偶数,不然就不能是镜像字符串
2.找到规律,在下列代码有。
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main(void){
int i,m,t;
char *a,*b;
a=(char *