Jump Columns + 1
Knowing rows, we can find out cols. Knowing cols, we can jump to the next letter (cols + 1).\n\nExample: "ch   ie   pr", rows = 3, columns = 12 / 3 = 4.\n0: [0,
Knowing `rows`, we can find out `cols`. Knowing `cols`, we can jump to the next letter (`cols + 1`).\n\nExample: `"ch   ie   pr"`, rows = 3, columns = 12 / 3 = 4.\n0: [0, 5, 10] `"cip"`\n1: [1, 6, 11] `"her"`\n2: [2, 7] `"  "` <- we will trim this.\n3: [3, 8] `"  "` <- we will trim this.\n\n**Java**\n```java\npublic String decodeCiphertext(String encodedText, int rows) {\n    int sz = encodedText.length(), cols = sz / rows;\n    StringBuilder sb = new StringBuilder();\n    for (int i = 0; i < cols; ++i)\n        for (int j = i; j < sz; j += cols + 1)\n            sb.append(encodedText.charAt(j));\n    return sb.toString().stripTrailing();\n}\n```\n**Python 3**\n```python\nclass Solution:\n    def decodeCiphertext(self, encodedText: str, rows: int) -> str:\n        cols, res = len(encodedText) // rows, ""\n        for i in range(cols):\n            for j in range(i, len(encodedText), cols + 1):\n                res += encodedText[j]\n        return res.rstrip()\n```\n**C++**\n```cpp\nstring decodeCiphertext(string encodedText, int rows) {\n    int sz = encodedText.size(), cols = sz / rows;\n    string res;\n    for (int i = 0; i < cols; ++i)\n        for (int j = i; j < sz; j += cols + 1)\n            res += encodedText[j];\n    while (!res.empty() && isspace(res.back()))\n        res.pop_back();\n    return res;\n}\n\n```
['C', 'Java', 'Python3']