I'm having trouble with this project because when I put a sentence such as "cat is not a dog", it will not say "Didn't find repeated word" as intended. Instead, it will say "Found repeated word", as if I it was true. Also, each time it is run for the first time, the first letter is removed from the user input. Why?
#include <iostream>
#include <iomanip>
#include <string>
#include <fstream>
#include <time.h>
#include <stdio.h>
using namespace std;
int main()
{
    int count = 0;
    bool repeat = false;
    char yn;
    string input, newWord, firstword;
    do
    {
        count = 0;
        repeat = false;
        cin.sync();
        cout << "Please enter a sentence: ";
        cin.ignore();
        getline(cin, input);
        while (input.at(count) != ' ')
            count++;
        firstword = input.substr(0, count);
        input = input.substr(count++);
        count = 0;
        while(count < input.size() && repeat == false)
        {
            count++;
            while (count < input.size() && input.at(count) != ' ')
                count++;
            newWord = input.substr(0, count);
            if (firstword.compare(newWord) == 0)
                input = input.substr(count++);
            else
                repeat = true;
        }
        if (repeat == true)
        {
            cout << "\nI found a repeated word!";
            cout << "\nWould you like to try again? (y/n)";
            cin >> yn;
        }
        else if(repeat == false)
        {
            cout << "\nI didn't find a repeated word.";
            cout << "\nWould you like to try again? (y/n)";
            cin >> yn;
        }
    } while (yn == 'y');
}
 
     
    