One parent, multiple children pipe with fork()

The task I have to do is something along the lines "I receive some input and based on the first character I send it through pipe to one of the children to print".
The scheme it is based on is 1->2; 1->3; 1->4; 2 will print all the input that starts with a letter, 3 will print all the input that starts with a digit and 4 will print everything else. (Example: 12, Anne, **, *a will be printed by 3, 2, 4, 4)
I have quite understood how pipes work between one parent process and one child, but can't figure it out how to make this work, but I have tried, so I'mma attach the code down below. Any tip would be much appreciated.

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

int main()
{ int pipefd[2];
  int pipefe[2];
  int pipeff[2];
  pipe(pipefd);
  pipe(pipefe);
  pipe(pipeff);

  char arr[80];
  scanf("%s", arr);
  int f1 = fork();
  
  if(f1>0)
	{close(pipefd[0]);
	 close(pipefe[0]);
	 close(pipeff[0]);
	 if (arr[0]>='A'&&arr[0]<='z')
		{
         	write(pipefd[1], arr, strlen(arr)+1);
	 	close(pipefd[1]);
		}
	if(arr[0]>='0' && arr[0]<='9')
		{
		write(pipefe[1], arr, strlen(arr)+1);
	 	close(pipefe[1]);
		}
	else
	   {
	    write(pipeff[1], arr, strlen(arr)+1);
	    close(pipeff[1]);
	   }
         exit(0);
	}
   else if(fork()==0)
     { wait(NULL);
       close(pipefd[1]);
       read(pipefd[0], arr, strlen(arr)+1);
       printf("%s\n", arr);
       close(pipefd[0]);
       exit(0);
     }
   else if(fork()==0)
     { wait(NULL);
       close(pipefe[1]);
       read(pipefe[0], arr, strlen(arr)+1);
       printf("%s\n", arr);
       close(pipefe[0]);
       exit(0);
     }
   else if(fork()==0)
     { wait(NULL);
       close(pipeff[1]);
       read(pipeff[0], arr, strlen(arr)+1);
       printf("%s\n", arr);
       exit(0);
       return 0;
     }

}
 else if(fork()==0)

You have three of these. No. any call to fork() creates a pid, you just lost the pid of the new process.

else  
{ mypid1 = fork();
  if (mypid!=0 ) 
  {
    // do something 
  }
}

And I don't see what your program logic should be using your current model. Get it working for one child process only. Set up pipes for that. As you have your code now there can be a race condition on pipes it seems to me.

If you have to have multiple children learn about IPC here, use a mutex on shared memory if you have to have this odd cascade of processes.

IPC: https://www.tldp.org/LDP/tlk/ipc/ipc.html

In short, how fork() really works:

pid_t pid=fork();

if(pid < 0)
{
    perror("couldn't fork");
    exit(1);
}

if(pid == 0) {
        // Child code
        do_stuff();
        exit(0);
}

// Parent code