Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rows, cols = [int(n) for n in input().split()]
- text = input()
- matrix = []
- text_idx = 0
- for row in range(rows):
- current_row = [''] * cols
- if row % 2 == 0:
- for col in range(cols):
- current_idx = text_idx % len(text)
- current_row[col] = text[current_idx]
- text_idx += 1
- else:
- for col in range(cols - 1, -1, -1):
- current_idx = text_idx % len(text)
- current_row[col] = text[current_idx]
- text_idx += 1
- matrix.append(current_row)
- for r in range(rows):
- print(*matrix[r], sep='')
Advertisement
Advertisement
Advertisement
RAW Paste Data
Copied
Advertisement