Language: C

#include <stdio.h>
#include <stdlib.h>

struct word{
  char w[31];
  int p;
}wo[1000];

int compare(const void *a,const void *b){
  int i;
  for(i=0;;i++){
    if((struct word *)a->w[i]!='\0'&&(struct word *)b->w[i]=='\0')return -1;
    if((struct word *)a->w[i]=='\0'&&(struct word *)b->w[i]!='\0')return 1;
    if((struct word *)a->w[i]=='\0'&&(struct word *)b->w[i]=='\0')return 0;
    if((struct word *)a->w[i]!=(struct word *)b->w[i]){
      return (struct word *)a->w[i]-(struct word *)b->w[i];
    }
  }
  return 0;
}
    
int main(void) {
  int i=0,j,d;
  char s;
  
  while(scanf("%s%d",wo[i].w,&(wo[i++].d)));
  qsort(wo,i,sizeof(struct word),compare);
  
  for(j=0;j<i;j++){
    printf("%s %d",wo[j].w,wo[j].p);
    for(k=j+1;strcmp(wo[j].w,wo[k].w)==0;k++){
      printf(" %d",wo[k].p);
    }
    puts("");
    j=k-1;
  }
  i=0;
  }

  return 0;
}

Compiler output:
main.c: In function 'compare':
main.c:12:24: warning: dereferencing 'void *' pointer
   12 |     if((struct word *)a->w[i]!='\0'&&(struct word *)b->w[i]=='\0')return -1;
      |                        ^~
main.c:12:24: error: request for member 'w' in something not a structure or union
main.c:12:54: warning: dereferencing 'void *' pointer
   12 |     if((struct word *)a->w[i]!='\0'&&(struct word *)b->w[i]=='\0')return -1;
      |                                                      ^~
main.c:12:54: error: request for member 'w' in something not a structure or union
main.c:13:24: warning: dereferencing 'void *' pointer
   13 |     if((struct word *)a->w[i]=='\0'&&(struct word *)b->w[i]!='\0')return 1;
      |                        ^~
main.c:13:24: error: request for member 'w' in something not a structure or union
main.c:13:54: warning: dereferencing 'void *' pointer
   13 |     if((struct word *)a->w[i]=='\0'&&(struct word *)b->w[i]!='\0')return 1;
      |                                                      ^~
main.c:13:54: error: request for member 'w' in something not a structure or union
main.c:14:24: warning: dereferencing 'void *' pointer
   14 |     if((struct word *)a->w[i]=='\0'&&(struct word *)b->w[i]=='\0')return 0;
      |                        ^~
main.c:14:24: error: request for member 'w' in something not a structure or union
main.c:14:54: warning: dereferencing 'void *' pointer
   14 |     if((struct word *)a->w[i]=='\0'&&(struct word *)b->w[i]=='\0')return 0;
      |                                                      ^~
main.c:14:54: error: request for member 'w' in something not a structure or union
main.c:15:24: warning: dereferencing 'void *' pointer
   15 |     if((struct word *)a->w[i]!=(struct word *)b->w[i]){
      |                        ^~
main.c:15:24: error: request for member 'w' in something not a structure or union
main.c:15:48: warning: dereferencing 'void *' pointer
   15 |     if((struct word *)a->w[i]!=(struct word *)b->w[i]){
      |                                                ^~
main.c:15:48: error: request for member 'w' in something not a structure or union
main.c:16:30: warning: dereferencing 'void *' pointer
   16 |       return (struct word *)a->w[i]-(struct word *)b->w[i];
      |                              ^~
main.c:16:30: error: request for member 'w' in something not a structure or union
main.c:16:53: warning: dereferencing 'void *' pointer
   16 |       return (struct word *)a->w[i]-(struct word *)b->w[i];
      |                                                     ^~
main.c:16:53: error: request for member 'w' in something not a structure or union
main.c: In function 'main':
main.c:26:39: error: 'struct word' has no member named 'd'
   26 |   while(scanf("%s%d",wo[i].w,&(wo[i++].d)));
      |                                       ^
main.c:31:9: error: 'k' undeclared (first use in this function)
   31 |     for(k=j+1;strcmp(wo[j].w,wo[k].w)==0;k++){
      |         ^
main.c:31:9: note: each undeclared identifier is reported only once for each function it appears in
main.c:31:15: error: implicit declaration of function 'strcmp' [-Wimplicit-function-declaration]
   31 |     for(k=j+1;strcmp(wo[j].w,wo[k].w)==0;k++){
      |               ^~~~~~
main.c:3:1: note: include '<string.h>' or provide a declaration of 'strcmp'
    2 | #include <stdlib.h>
  +++ |+#include <string.h>
    3 | 
main.c: At top level:
main.c:40:3: error: expected identifier or '(' before 'return'
   40 |   return 0;
      |   ^~~~~~
main.c:41:1: error: expected identifier or '(' before '}' token
   41 | }
      | ^