String clear is showing unexpected behaviour

question link : https://practice.geeksforgeeks.org/problems/sum-of-numbers-in-string/0

Try this:

what is the time complexity of string1==string2 operation?

if u use directly == operator to compare two strings then it should take O(1) time

how it compares values of two different containers in o(n)