题目描述
输入一串以‘!’结束的字符,按逆序输出。
样例输入
abc!
样例输出
cba
#include <iostream>
#include <cstdio>
using namespace std;
char ch[10000];
void gth(int i) {
if (ch[i] != '!') {
gth(i+1);
} else {
return;
}
printf("%c", ch[i]);
}
int main() {
gets(ch);
gth(0);
return 0;
}