|
|
back to boardCommon BoardQayerda xato #include <iostream> #include <string> using namespace std; int main () { string s[2002]; unsigned int n; bool t=false; bool t1=false; bool t2=false; bool t3=false; cin>>n; for( int i=1;i<=2*n;i++) { cin>>s[i]; if("Slytherin"==s[i]) t=true; if("Hufflepuff"==s[i]) t2=true; if("Gryffindor"==s[i]) t1=true; if("Ravenclaw"==s[i]) t1=true; } if(t) { cout<<"Slytherin:"<<endl; for(int i=1;i<=n;i++) if("Slytherin"==s[2*i]) cout<<s[2*i-1]<<endl; cout<<endl; } if(t2) { cout<<"Hufflepuff:"<<endl; for(int i=1;i<=n;i++) { if("Hufflepuff"==s[2*i]) cout<<s[2*i-1]<<endl; } cout<<endl; } if(t1) { cout<<"Gryffindor:"<<endl; for(int i=1;i<=n;i++) if("Gryffindor"==s[2*i]) cout<<s[2*i-1]<<endl; } if(t) { cout<<"Ravenclaw:"<<endl; for(int i=1;i<=n;i++) if("Ravenclaw"==s[2*i]) cout<<s[2*i-1]<<endl; } return 0; } bek_1122.@bk.ru |
|
|