// UVa 11192 - Group Reverse #include <iostream> #include <string> #include <algorithm> using namespace std; int main() { int g; cin >> g; while (g) { string s; cin >> s; int l = s.length() / g; string::iterator i = s.begin(); while (i != s.end()) { reverse(i, i + l); i += l; } cout << s << endl; cin >> g; } return 0; }
No comments:
Post a Comment