Get a string made of first and the last 2 chars

In this program, we will take a string as input and get a string made of the first and the last 2 chars from a given string

Steps to solve the program.
  1. Take a string as input.
  2. If the string consists of only 2 characters print True if not get a string made of the first and last 2 characters using indexing.
  3. Print the output.

Output :

list of strings and returns the length of the longest string.

Leave a Comment