class Solution { public: string reverseStr(string s, int k) { for (size_t i = 0; i < s.length(); i += 2 * k) { int start = i; int end = min(i+k, s.length()) - 1; while (start < end) swap(s[start++], s[end--]); } return s; } };