#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
struct stu
{
char name[100];
char from[100];
char to[100];
int flag=0;
}st[100];
int main()
{
int t;
cin>>t;
char name[100],city[100][20];
for(int i=0;i<t;i++)
{
cin>>st[i].name>>st[i].from>>st[i].to;
}
int ok=1,l=0,mark[100]={0};
char to_city[100][20]={"zichuan","linzi","zhoucun","boshan"};
for(int i=0;i<t;i++)
{
for(int j=i+1;j<t;j++)
{
if(!strcmp(st[i].from,st[j].from))
{
st[j].flag=1;
}
}
}
for(int i=0;i<t;i++)
{
if(!st[i].flag)
{
strcpy(city[l++],st[i].from);
}
}
int k=0;
for(int i=0;i<l;i++)
{
cout<<city[i]<<" :";
for(int j=0;j<t;j++)
{
if(!strcmp(city[i],st[j].from))
{
cout<<" "<<st[j].name;
}
}
cout<<endl;
}
for(int i=0;i<4;i++)
{
cout<<to_city[i]<<" :";
for(int j=0;j<t;j++)
{
if(!strcmp(to_city[i],st[j].to))
{
cout<<" "<<st[j].name;
}
}
cout<<endl;
}
// for(int i=0;i<l;i++)cout<<city[i]<<endl;
return 0;
}
/***************************************************
User name: TJRAC6015203228魏杰
Result: Accepted
Take time: 0ms
Take Memory: 180KB
Submit time: 2016-10-31 22:00:53
****************************************************/
sdut2055来淄博旅游
最新推荐文章于 2019-07-17 18:51:19 发布