2102 - 【字符数组】字符输出
时间限制 : 1 秒
内存限制 : 32 MB
输入一行字符,用“#”作为结束标志,将字符倒序后输出。
题目输入
一行字符,用“#”结束。
题目输出
倒序后的字符序列。
输入/输出样例
输入格式
ABCDEFG#
输出格式
GFEDCBA
C语言解答
#include <stdio.h> #include<string.h> int main() { int i; char str[100]; gets(str); for(i=strlen(str)-2;i>=0;i--) printf("%c",str[i]); printf("\n"); }
C++解答
#include<bits/stdc++.h> using namespace std; string a; int main() { getline(cin,a,'#'); for(int i=a.size()-1;i>=0;i--) cout<<a[i]; return 0; }