(C++) 2075. Decode the Slanted Ciphertext
\n\nclass Solution {\npublic:\n    string decodeCiphertext(string encodedText, int rows) {\n        int cols = encodedText.size() / rows; \n        string ans; 
\n```\nclass Solution {\npublic:\n    string decodeCiphertext(string encodedText, int rows) {\n        int cols = encodedText.size() / rows; \n        string ans; \n        for (int offset = 0; offset < cols; ++offset) \n            for (int i = 0, j = offset;  i*cols+j < encodedText.size(); ++i, ++j) \n                ans.push_back(encodedText[i*cols+j]); \n        return ans.substr(0, 1+ans.find_last_not_of(\' \')); \n    }\n};\n```
['C']