You are on page 1of 1

User inputs the string and it gets stored in variable str
str = input("Enter a string: ")

counter = 0
for s in str:
      counter = counter+1
print("Length of the input string is:", counter) 

# User inputs the string
str = input("Enter a string: ")

# using len() function to find length of string
print("Length of the input string is:", len(str))

You might also like