#include #include void main() { char line[80]; char rec1[40], rec2[40], prev[40]=""; int i,j, nbr=0; while( gets( line ) != NULL ) { i=0; while(line[i] != ' ') { rec1[i] = line[i]; i++;} rec1[i] = '\0'; /* Da li su tekuca i prethodna rec anagrami */ if( strcmp( prev, rec1 ) == 0 ) { i++; nbr += 1; j=0; while(line[i] != '\0') { rec2[j] = line[i]; i++; j++; } rec2[j] = '\0'; printf("%s ", rec2 ); } else /* prev != rec1 */ { strcpy( prev, rec1 ); printf("\n"); i++; j=0; while(line[i] != '\0') { rec2[j] = line[i]; i++; j++; } rec2[j] = '\0'; printf("%s %s ", rec1, rec2 ); } } }