void leftRoutate(std::string& s, size_t offset) { auto reverse = [&](size_t begin, size_t end) { --end; while (begin <= end){ std::swap(s[begin], s[end]); ++begin; --end; } }; reverse(0, offset); reverse(offset, s.length ()); reverse(0, s.length ()); }
时间: 2024-10-13 08:39:33