 <p>Your <code>getPhrase</code> should look like this:</p> <pre><code>std::string getPhrase() { std::string result; std::cout &lt;&lt; "Enter phrase: "; std::getline(std::cin, result); return result; } </code></pre> <p>Then:</p> <pre><code>int main() { std::string phrase = getPhrase(); // ... } </code></pre>