C++ | Easy | Simple Iterate
1) Just create matrix from given encoded text.\n2) Iterate Diagonally\n\nNote : the number of column is ceil value of (size of given string / given rows)\n\ncla
1) Just create matrix from given encoded text.\n2) Iterate Diagonally\n\nNote : the number of column is **ceil value of (size of given string / given rows)**\n```\nclass Solution {\npublic:\n    string decodeCiphertext(string s, int r) {\n        int c = s.size()/r + (s.size()%r!=0);\n        vector<vector<char>>vc(r,vector<char>(c));\n        int row = -1 , col = -1;\n        for(int i=0;i<s.size();i++)\n        {\n            if(i%c==0)\n            {\n                row++;\n                col=0;\n            }\n            vc[row][col++] = s[i];\n        }\n        \n//         for(int i=0;i<r;i++)\n//         {\n//             for(int j=0;j<c;j++)\n//             {\n//                 cout<<vc[i][j];\n    \n//             }\n//             cout<<endl;\n//         }\n        string ans = "";\n        int column=0;\n        while(column<c)\n        {\n            int crRow = 0;\n            int crCol = column;\n            while(crRow<r and crCol<c)\n            {\n                ans+=vc[crRow++][crCol++];\n            }\n            column++;\n        }\n        while(ans.back()==\' \')\n            ans.pop_back();\n        return ans;\n    }\n};\n```
['C', 'Iterator']