字符串翻转

题目描述

写出一个程序,接受一个字符串,然后输出该字符串反转后的字符串。

输入描述:

write description here:输入N个字符1

输出描述:

write description here:输出该字符串反转后的字符串

输入例子:

abcd

输出例子:

dcba

调试通过的代码

1
2
3
4
5
6
7
8
9
10
//write code here
#include <iostream>
#include <string>
using namespace std;
int main(){
string str;
cin >> str;
for(int i = str.size()-1; i >=0;i--)
cout << str[i];
}

来源:牛客网

文章目录
  1. 1. 题目描述
    1. 1.1. 输入描述:
    2. 1.2. 输出描述:
    3. 1.3. 输入例子:
    4. 1.4. 输出例子:
  2. 2. 调试通过的代码
|