Toppykung
Author: Pakin Olanraktham & Black Cat
Source: PROGRAMMING.IN.TH
Difficulty: ?
Prerequisites:
เฉลย
#include <stdio.h>
#include <string.h>
int main() {
int n;
scanf("%d", &n);
char s[n][31];
for (int i = 0; i < n; i++) scanf("%s", s[i]);
for(int i=0; i<n-1; i++)
for(int j=i+1; j<n; j++){
if(strcmp(s[i],s[j])>0) {char temp[31]; strcpy(temp,s[i]), strcpy(s[i],s[j]), strcpy(s[j],temp);}
}
printf("%s\n", s[0]);
for (int i = 1; i < n; i++) if (strcmp(s[i],s[i-1])) printf("%s\n", s[i]);
}