给你一个最短代码:

#include <iostream>
#include <string>
int main(){
    std::string str;
    std::cin >> str;
    for(int i = str.length()-2;i >= 0; i--)   std::cout << str[i];
}

小细节:str.length()-1减掉的是'\0'哦~

相关文章:

  • 2021-10-01
  • 2021-06-28
  • 2021-11-01
  • 2021-08-13
  • 2021-10-14
  • 2021-07-22
  • 2022-02-13
猜你喜欢
  • 2021-05-09
  • 2022-12-23
  • 2022-02-12
  • 2021-08-08
  • 2021-07-17
  • 2022-12-23
  • 2021-10-14
相关资源
相似解决方案