You can use the length() or size() member function of the string class to determine the length of a string.
Here's an example:
#include <iostream>
#include <string>
int main() {
std::string userInput;
std::cout << "Enter a string: ";
std::getline(std::cin, userInput);
std::cout << "Length of the string: " << userInput.length() << std::endl;
return 0;
}