#include#include int main() { std::string str = "hello"; std::cout << "Size of string: " << str.end() - str.begin() << std::endl; return 0; }
#includeOutput: `h e l l o` The string::end method is part of the C++ Standard Library.#include int main() { std::string str = "hello"; for (auto it = str.begin(); it != str.end(); ++it) { std::cout << *it << " "; } return 0; }