Calculate the length of a string with loop logic

In this program, we will take a string as input and calculate the length of a string with loop logic

Steps to solve the proram
  1. Take a string as input and create a variable and assign its value equal to zero.
  2. Use For loop to iterate over each character of the string.
  3. After each iteration add 1 to the variable to find the length of the string.
  4. To verify our solution find the length of the string using built it function len().
  5. Print the output.

Output :

most simultaneously repeated characters in the input string.

replace the second occurrence of any char with the special character $.

Leave a Comment