//將關系存入二維向量A轉化為關系矩陣
//輸入ab ac ad ae'\n'
#include<iostream>
using namespace std;
int main(){
cout<<"輸入關系:";
int a=0,b=0;char e,r;
char s[5]={'a','b','c','d','e'};
int A[5][5]={0};
int count=1;
for(;cin>>e>>r;){
for(int i=0;i<5;i++){
if(s[i]==e) a=i;
if(s[i]==r) b=i;
}
A[a][b]=1;
if(getchar()=='\n')
break;
}
for(int i=0;i<5;i++){
for(int j=0;j<5;j++)
cout<<A[i][j]<<" ";
cout<<endl;
}
return 1;
}