https://www.codingame.com/ide/puzzle/ascii-art

Source


        vstr vstrWholeLines;
        for (int i = 0; i < H; i++) {
            string ROW;
            getline(cin, ROW);
            vstrWholeLines.push_back(ROW);
        }

        const int numLetters = ceil(vstrWholeLines.front().length() / L);

        vector<vstr> vvstrLetters(numLetters);

        for (string line : vstrWholeLines) {
            size_t prev = 0;
            FOR (i, numLetters) {
                vvstrLetters[i].push_back(line.substr(prev, L));
                prev += L;
            }
        }

        const int lastIdx = 'Z' - 'A' + 1;
        vi viAnsIdx;
        FOR (i, N) {
            int diff = 'a' - 'A';
            int idx = T[i]-'A';
            if (idx >= diff) idx -= diff;
            if (idx > (lastIdx) || idx < 0) idx = lastIdx;
            viAnsIdx.push_back(idx);
        }

        // Print answer
        FOR (j, H) {
            for (int i : viAnsIdx) {
                cout << setw(L) << left << vvstrLetters[i][j];
            }
            cout << "\n";
        }

GitHub