Created
September 15, 2018 06:26
-
-
Save completejavascript/f6e2f1634af16a391930f3f3db992854 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while(1): | |
# Nhap so luong cot | |
num_col = int(raw_input()) | |
if num_col == 0: | |
break | |
# Xau dau vao | |
str_input = raw_input() | |
# Tinh so luong cot | |
num_row = len(str_input) / num_col; | |
# Chuyen xau dau vao thanh dang ma tran | |
# va luu dang xau binh thuong | |
string = "" | |
for i in range(0, num_row): | |
if i % 2 == 0: | |
string += str_input[i*num_col : (i+1)*num_col] | |
else: | |
string += (str_input[i*num_col : (i+1)*num_col])[::-1]# dao nguoc xau | |
# xau ket qua | |
result = "" | |
for j in range(0, num_col): | |
for i in range(0, num_row): | |
result += string[i*num_col + j] | |
print result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment