#include #include #include #include //#include using namespace std; int main(int argc, char *argv[]) { unsigned int repeat; //ifstream cin( "../enc.in" ); for (cin >> repeat; repeat; cin >> repeat) { string origline, cleaned, output; getline(cin, origline); //Line with number getline(cin, origline); unsigned int spaces = count(origline.begin(), origline.end(), ' '); unsigned int chars = origline.size() - spaces; cleaned.reserve(chars); output.assign(chars, ' '); for (unsigned int i = 0; i < origline.size(); i ++) { if (origline[i] == ' ') continue; cleaned.push_back(toupper(origline[i])); } if (chars <= repeat) { output.assign(cleaned); } else { unsigned int j = 0; for (unsigned int i = 0; j < chars; j ++) { if (i >= chars) { i = 0; while (output[i] != ' ') i ++; } output.replace(i, 1, 1, cleaned[j]); i = (i + repeat); } } cout << output << endl; } return 0; }