scanf_s string with spaces in between

void del() {
int temp = checker;
char search[30];
printf("Please enter the book name to be removed : ");
scanf_s("%[^\n]s", search, 30);
//fgets(search, 30, stdin);
for (int i = 0; i < checker; i++) {
    if (strcmp(search, bookshelf[i].name) == 0) {
        for (int j = i+1; j < checker; j++) {
            strcpy_s(bookshelf[i].name, 31, bookshelf[j].name);
            strcpy_s(bookshelf[i].semi_ISBN, 5, bookshelf[j].semi_ISBN);
            bookshelf[i].page = bookshelf[j].page;
            i++;
        }
        checker--;
        printf("%s is removed from your bookshelf.\n\n", search);
    }
}
if(temp==checker)
    printf("%s is not in your bookshelf.\n\n", search);

}

this is my code, and for some reason, when I try to use either the scanf_s or fgets, the result shown is: "Please enter the book name to be removed : 儆儆儆儆儆儆儆儆儆儆儆儆儆儆儆儆儆儆儆儆 is not in your bookshelf." as soon as I run the function (did not type anything).

What could be wrong..?