include
include<stdio.h>
include<stdlib.h>
using namespace std;
int main() { int s=0,c=0,i=0,j=0,k=0,v=0,u=0,d=0,l=0;
cin>>s>>c;
char ser[s][27],com[c][28];
fflush(stdin); for(i=0;i<s;i++) { gets(ser[i]);fflush(stdin); } fflush(stdin);
for(i=0;i<c;i++) { gets(com[i]);fflush(stdin); } fflush(stdin);
for(i=0;i<c;i++) { int j; for(j=0;com[i][j]!=' ';j++); for(k=0;k<s;k++) { d=0; for(v=0;ser[k][v]!=' ';v++); l=j; while((com[i][l]!=';'||ser[k][v])&&d==0) { d=com[i][l++]-ser[k][v++]; } if(d==0) { cout<<com[i]<<" "; cout<<"#"; for(u=0;ser[k][u]!=' ';u++) cout<<ser[k][u]; cout<<"\n"; break; } } } return 0; }
Please post the link to your submission, not the code. It's impossible to read because formatting is messed up.