def convert(s, numRows):
    # 初始化数组
    rows = [''] * numRows
    index = 0
    isInc = True
    for char in s:
        if index == 0:
            isInc = True
        elif index + 1 == numRows:
            isInc = False
        offset = 1 if isInc else - 1
        rows[index] = rows[index] + char
        index = index + offset

    str = ''
    for row in rows:
        str = str + row

    print(str)


str = "0123456789"
str = "LEETCODEISHIRING"

convert(str, 3)
convert(str, 4)