If input is: Jane Silly Doe Output is: Doe, J.S.
If input is: Julia Clark Output is: Clark, J. Issue:
I can make it run for either or but not both
This only works for input Jane Silly Doe but not for input Julia Clark. I can make it run for either or but not both at the same time.
string = input()
words = string.split()
title = ''
for word in words:
title += word
another = (words[-1]+',')
second = (words[0])
third = (words[1])
fourth = second + third
upper = ''
for char in fourth:
if char.isupper():
upper += char
join_string = '.'.join(upper)
print(another, join_string + '.')