#Write a program that reads a persons name in the following format: 

# firstName middleName lastName(in one line)
# and output the person's name in the following format: 

# lastName, firstInitial.middleInitial 

# Ex: If the input is: 
# Pat Silly Doe 

#The Output is 
# Doe, P.S. 

# if the input has the following format: 
# firstName lastName (in one line)

# The output is: 
# lastName, firstInitial 

#Ex if the input is 
#Julia Clark 

#The output is 
#Clark, J. 


fullName = input()
parts = fullName.split()

if len(parts) == 3: 
    firstName = parts[0]
    middleName = parts[1][0]
    lastName = parts [2]

    print(f'{lastName}, {firstName[0]}. {middleName}.')

else: 
    lastName = parts[1]
    firstName = parts[0]
    print(f'{lastName}, {firstName[0]}')

    


Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: