TOJ 1153

//用c语言做的话会很快,主要锻炼一下string的使用 ,但是老提示reverse未声明 
#include <iostream>
#include <string>
#include <string.h>
#include <list>
using namespace std;
int main()
{
    int i,T;
    cin>>T;
    while(T--)
    {
        string s;
        /*
        while(cin>>s)
        {
            if(s=="\n")
            {
                cout<<"\b";
                cout<<endl;
                break;
            }
            reverse(s.begin(),s.end());
            cout<<s<<" ";
        }
        总显示 reverse没有声明 
        */
        cin>>s;
        for(i=s.length()-1;i>=0;i--)
            cout<<s[i];
        if(getchar()!='\n')
            cout<<" ";
        else
            cout<<endl; 
    }
    return 0;
}
        
        
原文地址:https://www.cnblogs.com/hxsyl/p/2631520.html