逆向迭代器

数字颠倒

http://www.nowcoder.com/questionTerminal/ae809795fca34687a48b172186e3dafe

#include <iostream>
#include <map>
#include <unordered_set>
#include <string>
#include <algorithm>

using namespace std;

// 默认输入合法
int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::setvbuf(stdout, nullptr, _IOFBF, BUFSIZ);

    unordered_set<char> charSet;
    string str;
    cin>>str;
    //reverse(str.begin(),str.end());
    const auto end = str.crend();
    auto begin = str.crbegin();

    while (begin != end) {
        cout<<*begin;
        begin++;
    }

    //cout<<str;
    return 0;
}
全部评论

相关推荐

点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
昨天 18:18
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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