#include<
stdio.h>
#include<
stdlib.h>
#include<
string.h>
typedef struct Link
{
int num;
char *p;
struct Link *next;
}Link;
void Insert(Link *head,char *str)
{
while(head->next!=NULL)
{
head = head ->next;
if(strcmp(str,head->p)==0) { head->num++; return ;}
}
Link *tmp = (Link*)malloc(sizeof(Link));
tmp->p = (char *) malloc(sizeof(str));
strcpy(tmp->p,str);
tmp->num=1;
tmp->next=NULL;
head->next=tmp;
// return node;
}
void print(Link *head)
{
Link *node = head->next;
while(node!=NULL)
{
printf("%s:%d\n",node->p,node->num);
node=node ->next;
}
}
int main()
{
int n;
Link *head=(Link*)malloc(sizeof(Link*));
scanf("%d",&n);
while(n--)
{
char tmp[100];
scanf("%s",tmp);
Insert(head,tmp);
}
print(head);
return 0;
}