def check_palindrome(data):
    """ Given a string, check if it is a palindrome by ignoring spaces. E.g.
    race car would be a palindrome.
    """
    n = len(data)
    i = 0
    j = n - 1

    while i < j:
        if data[i] == ' ':
            i += 1
            continue
        if data[j] == ' ':
            j -= 1
            continue
        if data[i] != data[j]:
            return False
        i += 1
        j -= 1

    return True