Reading a string in c


How do I read and find the spaces, tabs and newline in c? The input is keyboard and it should stop at EOF.
I’m trying to solve this for past few days and I’m not able to find functions/ways to get this done.

//Program to find number of spaces, tabs and newline.
#include <stdio.h>
#include <string.h>

int main()
    //X is spaces, Y is tabs and Z is newline.
    int x = 0,y = 0,z = 0, i = 0;
    int string;

    printf("Enter the sentence: ");
    while((string = getchar() != EOF))

        if (string == ' ')
        if (string == '\t')
        if (string == '\n')
        printf("There are %d Blanks\n", x);
        printf("There are %d tabs\n",y);
        printf("There are %d newline\n",z);
        return 0;