class Solution:
def decodeCiphertext(self, encodedText: str, rows: int) -> str:
l = len(encodedText)
cols = l // rows
def flat(x, y): #二维坐标转为一维
return x * cols + y
res = ''
for j in range(cols):
for k in range(rows):
if j+k< cols and k < rows:
res += encodedText[flat(k, j+k)]
return res.rstrip() #最后记得删除右侧多余的空格