why is it the validate file asks for input from stdin in the form: <username> \n <password> \n but this code asks for input in the form: <username> \n <password> \n \n \n \n? How do I fix this?

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>

#define MAXLINE 256

#define SUCCESS "Password verified\n"
#define INVALID "Invalid password\n"
#define NO_USER "No such user\n"

int main(void) {
  char user_id[MAXLINE];
  char password[MAXLINE];

  /* The user will type in a user name on one line followed by a password 
     on the next.
     DO NOT add any prompts.  The only output of this program will be one 
	 of the messages defined above.
     Please read the comments in validate carefully
   */

  if(fgets(user_id, MAXLINE, stdin) == NULL) {
      perror("fgets");
      exit(1);
  }
  if(fgets(password, MAXLINE, stdin) == NULL) {
      perror("fgets");
      exit(1);
  }
  
  // TODO
  // checking length 
  if (strlen(user_id) > 10) {
    printf(NO_USER);
    exit(1);  
  } 
  if (strlen(password) > 10) {
    printf(INVALID); 
    exit(1);  
  }

  // the hard shit
  int fds[2]; 
  if (pipe(fds) == -1) {
    exit(1); 
  } 
  
  int n = fork(); 
  if (n < 0) {
    exit(1);
  } else if (n == 0) {
    // child process
    dup2(fds[0], STDOUT_FILENO);  
    close(fds[0]); 
    close(fds[1]); 
    execl("./validate", "validate", NULL); 
    exit(1); 
  } else {
    // parent process
    close(fds[0]); 
    write(fds[1], user_id, 10); // hardcoded MAXPASSWORD
    write(fds[1], password, 10); 
    close(fds[1]);   

    int status; 
      if(wait(&status) == -1){
        exit(1);
      }

      if (WIFEXITED(status)) { // checks id process exits normally 
        int validation = WEXITSTATUS(status); 
        if (validation == 0) {
          printf("%s", SUCCESS); 
        } else if (validation == 1) {
          // error
          exit(1); 
        } else if (validation == 2) {
          printf("%s", INVALID); 
        } else if (validation == 3) {
          printf("%s", NO_USER); 
        }
      } else {
        exit(1);
      }
  }
  return 0;
}