First non repeating character in a string

I AM UNABLE TO PASS THE LAST TESTCASE WHICH IS
like s = “Create Challenge” in this the first non repeating character should be ‘r’ . stuck in how to calculate this if there is a space .

problem : CHARACTER GAME ON HACKERANK PLEASE GIVE ME THE SOLUTION FOR THIS CASE IF POSSIBLE

please provide the question link

Above is the question link.

this code will help u where u went wrong

u`ll have to see how to deal with spaces.
using cin.getlin()