题解 | #反序输出#

反序输出

https://www.nowcoder.com/practice/171278d170c64d998ab342b3b40171bb

#include <iostream>
using namespace std;

void reverse(string s)
{
    for(int i=0;i<s.length()/2;i++)
    {
        char c=s[i];
        s[i]=s[s.length()-1-i];
        s[s.length()-1-i]=c;
    }
    cout<<s<<endl;
}

int main() {
    string s;
    while(cin>>s)reverse(s);
}
// 64 位输出请用 printf("%lld")

全部评论

相关推荐

迷茫的大四🐶:好一个误闯天家,我也想闯一闯
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务