Perpendicular Words
Write a program to print all the perpendicular words in S.
sample input 1
CAT BAT VIN
sample output1
CBV
AAI
TTN
sample input 2
MAM BY DORM
sample output 2
MBD
AYO
M R
M
inputString=input().split(' ')
wordMax=max(inputString,key=len)
for index in range(0,len(wordMax)):
for word in inputString:
if index<len(word):
print(word[index],end="")
else:
print(" ",end="")
print()
Comments
Leave a comment