#include #include #include bool similar = false; bool wrong = false; struct x1 { int idx; char array[60]; }; int main(){ struct x1 x1[50]; int n_p = 0; int i1=0; while(i1 >=0) { i1=i1+1; char idx1[60]; int idx2 =0; int nikita = scanf("%d", &idx2); if (nikita == -1) { break; } if (idx2 == 0) { wrong = true; } fgets(idx1, 60 , stdin); int g=0; while (g x1[dima].array[1]){ int sidorenko = x1[i].idx; char tmp_name[60]; strcpy(tmp_name, x1[i].array); x1[i].idx = x1[dima].idx; strcpy(x1[i].array, x1[dima].array); x1[dima].idx = sidorenko; strcpy(x1[dima].array, tmp_name); } if(x1[i].array[1] == x1[dima].array[1]) { if(x1[i].array[2] > x1[dima].array[2]){ int sidorenko = x1[i].idx; char tmp_name[60]; strcpy(tmp_name, x1[i].array); x1[i].idx = x1[dima].idx; strcpy(x1[i].array, x1[dima].array); x1[dima].idx = sidorenko; strcpy(x1[dima].array, tmp_name); } } } } } printf("Vysledky:\n"); int i3=0; while (i3 < n_p) { i3=i3+1; printf("%d", x1[i].idx); printf("%s", x1[i].array); } return 0; }