Find the first repeated character and its index.

In this program, we will take a string as input and find the first repeated character in a string and its index.

Steps to solve the program
  1. Take a string as input.
  2. Use for loop with range() function to find the first repeated character.
  3. Find the index of that character using Index().
  4. After finding the first character break the loop.
  5. Print the output.

Output :

index of each character in a string.

swap cases of a given string using python.

Leave a Comment