let str ="Hello World! "
console.log(str.length);
//17
// string::length
#include <iostream>
#include <string>
int main ()
{
std::string str ("Test string ");
std::cout << "The size of str is " << str.length() << " bytes.
";
return 0;
}
//The size of str is 18 bytes.
#include<string.h>
string s;
cin>>s;
int len;
len=s.length();
#include <string>
#include <iostream>
int main()
{
std::string s(21, '*');
std::cout << s << std::endl;
return 0;
}