1017:字符串正反连接

xiaoxiao2021-02-28  100

1017:字符串正反连接

Description

所给字符换正序和反序连接,形成新串并输出。

Input

任意字符串(长度<=50)。

Output

字符串正序和反序连接所成的新字符串。

Sample Input

123abc

Sample Output

123abccba321

#include<iostream> #include<stdio.h> #include<string.h> using namespace std; int main() { char str[100]; int n=0; gets(str); n=strlen(str); int i; for( i=0;i<n;i++) printf("%c",str[i]); for(i=n-1;i>=0;i--) printf("%c",str[i]); return 0; }

转载请注明原文地址: https://www.6miu.com/read-85689.html

最新回复(0)