Given a full name in the form of a string, the task is to print the initials of a name, in short, and surname in full.
Input: Devashish Kumar Gupta Output: D. K. Gupta Input: Ishita Bhuiya Output: I. Bhuiya
Approach: The basic approach is to extract words one by one and then print the first letter of the word, followed by a dot(.). For the surname, extract and print the whole word.
Below is the implementation of the above approach:
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Python | Print the initials of a name with last name in full
- Program to find the initials of a name.
- Program to print Hut
- Program to print the given Z Pattern
- Program to print the Sum of series -1 + 2 + 11 + 26 + 47 +.....
- C++ program to print all Even and Odd numbers from 1 to N
- Program to print the pattern "GFG"
- Program to print pattern
- Program to print the pattern 'G'
- Program to print the given H Pattern
- Program to print the pattern ‘D’
- Program to print 2D shapes
- Program to print last N lines | Set-2
- Program to print DNA sequence
- Program to print numeric pattern
- C Program to Print all digits of a given number
- Program to print the given digit in words
- Program to Print the Trapezium Pattern
- Program to print numeric pattern | Set - 2
- Program to print a pattern of numbers
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.