Write a function that is given a phrase and returns the phrase we get if we take out the first word from the input phrase.

PHOTO EMBED

Tue Dec 14 2021 12:08:47 GMT+0000 (Coordinated Universal Time)

Saved by @abzal_nurgazy #c++

#include <iostream>
#include <string>
using namespace std;
using std::string;


string restWord(string str);

int main()
{	
	string str;
	cout << "Enter the string: " << endl;
	getline(cin, str);
	
	
	cout << restWord(str) << endl;

	return 0;
}

string  restWord(string str)
{
	int cnt=0;
	string result ="";

	for (int i = 0; !isspace(str[i]) && str.size(); i++)
	{
		++cnt ;
	}

	for (int j = cnt + 1; j < str.size(); j++)
	{
		result += str[j];
	}


	return result;
}
content_copyCOPY