Look at the std::references. string - C++ Reference

length() is provided for you. There isn't much work for you to do.