You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
509 B

2 years ago
#include <bits/stdc++.h>
using namespace std;
int main() {
string a;
//问题1错误的使用了getline
//getline(cin,a);
//完全没有必要使用getline,因为题目没有可能包含空格使用cin即可
//问题2错误的使用for循环重复读取a,因为a是string,是一次性cin读取。
//问题3a的界限是 a.size()-1 ,0 而不是a.size(),1
cin >> a;
for (int i = a.size() - 1; i >= 0; i--) printf("%c", a[i]);
return 0;
}