Write a program that asks the user to input his name and print its initials. Assuming that the user always types first name, middle name and last name and does not include any unnecessary spaces.

For example, if the user enters Ajay Kumar Garg the program should display A. K. G.
Note:Don't use split() method

Source Code

text = input('Enter a string: ')
#index of first space
space1 = text.find(' ')
#index of second space
space2 = text.find(' ',space1+1)
newtext = text[0] +'. '  + text[space1+1] +'. ' + text[space2+1] +'.'
print('New string:', newtext)

Output

Enter a string: Ajay Kumar Garg
New string: A. K. G.