Language: C

int main(void){
	char text[1024];
	int i,n;
	fgets(text,1024,stdin);
	n=strlen(text);
	for(i=0;i<n-5;i++){
		if((isspace(text[i]) || ispunct(text[i])) && (isspace(text[i+6]) || ispunct(text[i+6]))){
			i++;
			if(text[i]=='a' && text[i+1]=='p' && text[i+2]=='p' && text[i+3]=='l' && text[i+4]=='e'){
				text[i]='p';text[i+1]='e';text[i+2]='a';text[i+3]='c';text[i+4]='h';
			}
			else if(text[i]=='p' && text[i+1]=='e' && text[i+2]=='a' && text[i+3]=='c' && text[i+4]=='h'){
				text[i]='a';text[i+1]='p';text[i+2]='p';text[i+3]='l';text[i+4]='e';
			}
			else if(text[i]=='A' && text[i+1]=='p' && text[i+2]=='p' && text[i+3]=='l' && text[i+4]=='e'){
				text[i]='P';text[i+1]='e';text[i+2]='a';text[i+3]='c';text[i+4]='h';
			}
			else if(text[i]=='P' && text[i+1]=='e' && text[i+2]=='a' && text[i+3]=='c' && text[i+4]=='h'){
				text[i]='A';text[i+1]='p';text[i+2]='p';text[i+3]='l';text[i+4]='e';
			}
			else if(text[i]=='A' && text[i+1]=='P' && text[i+2]=='P' && text[i+3]=='L' && text[i+4]=='E'){
				text[i]='P';text[i+1]='E';text[i+2]='A';text[i+3]='C';text[i+4]='H';return 1;
			}
			else if(text[i]=='P' && text[i+1]=='E' && text[i+2]=='A' && text[i+3]=='C' && text[i+4]=='H'){
				text[i]='A';text[i+1]='P';text[i+2]='P';text[i+3]='L';text[i+4]='E';return 1;
			}
		}
	}
	printf("%s",text);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:4:9: error: implicit declaration of function 'fgets' [-Wimplicit-function-declaration]
    4 |         fgets(text,1024,stdin);
      |         ^~~~~
main.c:4:25: error: 'stdin' undeclared (first use in this function)
    4 |         fgets(text,1024,stdin);
      |                         ^~~~~
main.c:1:1: note: 'stdin' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'
  +++ |+#include <stdio.h>
    1 | int main(void){
main.c:4:25: note: each undeclared identifier is reported only once for each function it appears in
    4 |         fgets(text,1024,stdin);
      |                         ^~~~~
main.c:5:11: error: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
    5 |         n=strlen(text);
      |           ^~~~~~
main.c:1:1: note: include '<string.h>' or provide a declaration of 'strlen'
  +++ |+#include <string.h>
    1 | int main(void){
main.c:5:11: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch]
    5 |         n=strlen(text);
      |           ^~~~~~
main.c:5:11: note: include '<string.h>' or provide a declaration of 'strlen'
main.c:7:21: error: implicit declaration of function 'isspace' [-Wimplicit-function-declaration]
    7 |                 if((isspace(text[i]) || ispunct(text[i])) && (isspace(text[i+6]) || ispunct(text[i+6]))){
      |                     ^~~~~~~
main.c:1:1: note: include '<ctype.h>' or provide a declaration of 'isspace'
  +++ |+#include <ctype.h>
    1 | int main(void){
main.c:7:41: error: implicit declaration of function 'ispunct' [-Wimplicit-function-declaration]
    7 |                 if((isspace(text[i]) || ispunct(text[i])) && (isspace(text[i+6]) || ispunct(text[i+6]))){
      |                                         ^~~~~~~
main.c:7:41: note: include '<ctype.h>' or provide a declaration of 'ispunct'
main.c:29:9: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   29 |         printf("%s",text);
      |         ^~~~~~
main.c:29:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:29:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:29:9: note: include '<stdio.h>' or provide a declaration of 'printf'