Language: C++

int main(){
	char str[1000];
	char word[33][33]={0};
	int longest=0;
	int check[33]={0};
	char *tmp;
	int freq=0;
	int count=0;
	int i,j;
	size_t len , prev;
	fgets(str , sizeof(str) , stdin);
		tmp=str;
		for(i=0 ; str[i]!='\0' ;i++){
			if(str[i]==' '){
				str[i]='\0';
				strcpy((char*)&word[count] , (const char*)tmp);
				tmp=str+i+1;
				count++;
			}
		}
		strcpy((char*)&word[count],(const char*)tmp);
		count++;
	for(i=0 ; i<count ; i++){
		for(j=i ; j<count ; j++){
			if(strcmp((const char*)&word[i] , (const char*)&word[j])==0){
				check[i]++;
			}
		}
	}
	for(i=0 ; i<count-1 ; i++){
		if(check[freq]<check[i+1]){
			freq=i+1;
		}
	}
		prev=strlen(word[0]);
	for (i=0 ; i<count ; i++){
		len=strlen(word[i]);
		if(len > prev){
			prev = len;
			longest=i;
		}	
	}
	cout << (char*)&(word[freq]) << " "<< (char*)&(word[longest]);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'size_t' was not declared in this scope
   10 |         size_t len , prev;
      |         ^~~~~~
a.cc:1:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
  +++ |+#include <cstddef>
    1 | int main(){
a.cc:11:35: error: 'stdin' was not declared in this scope
   11 |         fgets(str , sizeof(str) , stdin);
      |                                   ^~~~~
a.cc:1:1: note: 'stdin' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int main(){
a.cc:11:9: error: 'fgets' was not declared in this scope
   11 |         fgets(str , sizeof(str) , stdin);
      |         ^~~~~
a.cc:16:33: error: 'strcpy' was not declared in this scope
   16 |                                 strcpy((char*)&word[count] , (const char*)tmp);
      |                                 ^~~~~~
a.cc:1:1: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
  +++ |+#include <cstring>
    1 | int main(){
a.cc:21:17: error: 'strcpy' was not declared in this scope
   21 |                 strcpy((char*)&word[count],(const char*)tmp);
      |                 ^~~~~~
a.cc:21:17: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:25:28: error: 'strcmp' was not declared in this scope
   25 |                         if(strcmp((const char*)&word[i] , (const char*)&word[j])==0){
      |                            ^~~~~~
a.cc:25:28: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:35:17: error: 'prev' was not declared in this scope
   35 |                 prev=strlen(word[0]);
      |                 ^~~~
a.cc:35:22: error: 'strlen' was not declared in this scope
   35 |                 prev=strlen(word[0]);
      |                      ^~~~~~
a.cc:35:22: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:37:17: error: 'len' was not declared in this scope
   37 |                 len=strlen(word[i]);
      |                 ^~~
a.cc:43:9: error: 'cout' was not declared in this scope; did you mean 'count'?
   43 |         cout << (char*)&(word[freq]) << " "<< (char*)&(word[longest]);
      |         ^~~~
      |         count