CONCATENATION GAME:
Sameer is playing a game. To win that game he has to combine the list of strings vertically(column wise) and present the final answer in that pattern.
input:
The first line of input contains an integer N that denotes the number of lists to combine
Each of the next N lines of the input contains strings separated by space.
i/p:
1
Hy
o/p:Hy
i/p:
2
by by
hy hy
o/p:
byhy
byhy
i/p:2
by hy
hy
o/p:
byhy
hy
i/p:3
Not you kid
They are got
Like great
o/p:
NotTheyLike
youaregreat
kidgot
n = int(input("Input n: "))
strings = []
for i in range(n):
str = input().split()
strings.append([])
for j in range(len(str)):
strings[i].append(str[j])
temp = 0
j = 0
while temp == 0:
temp = 1
for i in range(n):
if j < len(strings[i]):
temp = 0
print(strings[i][j], end="")
j += 1
print()
Comments
Leave a comment