Simulation || Easy C++ Solution
Code\n\nclass Solution \n{\npublic:\n    string decodeCiphertext(string encodedText, int rows) \n    {\n        if(rows==1) return encodedText;\n        int col
# Code\n```\nclass Solution \n{\npublic:\n    string decodeCiphertext(string encodedText, int rows) \n    {\n        if(rows==1) return encodedText;\n        int cols=encodedText.size()/rows;\n        vector<vector<char>> v(rows, vector<char> (cols,\' \'));\n        int i=0, done=0;\n        for(int x=0; x<rows; x++)\n        {\n            for(int y=0; y<cols; y++)\n            {\n                v[x][y]=encodedText[i++];\n                if(i==encodedText.size()) \n                {\n                    done=1;\n                    break;\n                }\n            }\n            if(done) break;\n        }\n        string ans="";\n        int r=0, c=0, col=0;\n        while(col<cols)\n        {\n            ans+=v[r][c];\n            r++, c++;\n            if(r==rows || c==cols)\n            {\n                r=0; col++;\n                c=col;\n            }\n        }\n        int j=ans.size()-1;\n        while(j>=0 && ans[j]==\' \') j--;\n        ans=ans.substr(0,j+1);\n        return ans;\n    }\n};\n```
['Simulation', 'C++']