#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
//排序,计算重复字符串个数,找最大不重复字符串
void DealWithStr(int n, int *RepeatStrNums, char StrArr[][50], char* SortedStr, char* pLargestNotRepeatStr)
{
int sum = 0;
char ans[100][100];
int q = 0;
int flag = 1;
for (int i = 0; i < n - 1; i++) {
flag = 1;
for (int j = i + 1; j < n; j++) {
if (strcmp(StrArr[i], StrArr[j]) == 0) {
for (int p = 0; p < q; p++) {
if (strcmp(ans[p], StrArr[i]) == 0) {
flag = 0;
}
}
if (flag != 0) {
strcpy(ans[q], StrArr[i]);
q++;
sum++;
}
}
}
}
for (int i = 0; i < n; i++) {
strcpy(&SortedStr[i], StrArr[i]);
}
}
int main(void)
{
char StrArr[100][50];//存储输入字符串
char *pLargestNotRepeatStr = NULL;//最大不重复字符串
int RepeatStrNums = 0;//重复字符串个数
char *SortedStr[100];//排序后字符串指针
int n;//需要输入的字符串个数
scanf("%d", &n);
for (int i = 0; i < n; i++)
{
scanf("%s", StrArr[i]);
}
DealWithStr(n, &RepeatStrNums, StrArr, SortedStr[100], pLargestNotRepeatStr);
for (int i = 0; i < n; i++)//打印排序前字符串
{
printf("%s\n", StrArr[i]);
}
for (int i = 0; i < n; i++)//打印排序后字符串
{
printf("%s\n", SortedStr[i]);
}
printf("%d\n", RepeatStrNums);//打印重复字符串个数
printf("%s\n", pLargestNotRepeatStr);//打印最大不重复字符串
return 0;
}