九度oj-1055

题目描述:

输入一个字符串,长度小于等于200,然后将数组逆置输出。

输入:

测试数据有多组,每组输入一个字符串。

输出:

对于每组输入,请输出逆置后的结果。

样例输入:

hdssg

样例输出:

gssdh

代码:

#include <stdio.h>  
#include <algorithm>  
#include <string.h>  
using namespace std;  
char a[210];  
int main()  
{  
    while(gets(a))  //gets并没返回参数,不需要!=EOF  
    {  
        int len=strlen(a);  
        reverse(a,a+len);  
        puts(a);  
    }  
    return 0;  
}  

作者提醒:

STL的使用简化,加快考试速度