why s.length() not s.size() ?
Q7. String STL 01
Hey @ankitkaushal
As per the documentation of c++(https://en.cppreference.com/w/cpp/string/basic_string), these are just synonyms. size() is there to be consistent with other STL containers (like vector, map, etc.) and length() is to be consistent with most peoples’ intuitive notion of character strings. People usually talk about a word, sentence or paragraph’s length, not its size, so length() is there to make things more readable. So length length is often used with strings.