In your code you're reading from the standard input twice. The first, you read just one word (one token until a white space character), then you read the whole line after the first token:
cin >> greetings;
getline(cin, greetings);
because of this, you always ignore the first token and only store anything following that in greetings.
To fix this, remove the first line above.
It is also a good practice, if you do not know what your code is doing, to start printing some debug messages. In your case, it would make sense to print the value of the greetings variable to see what's inside, and why your desired behaviour is not working.
std::cout << greetings << std::endl;
Since you did not share your program, just a screenshot, I can only do a theoretical analysis. It would make things much easier if you'd share your code so one can run it as well and ensure the proposed fix really works. :)
I hope this helps. Good luck! :)