ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Common Board

Qayerda xato
Posted by Yangiboyev Bekmurod 16 Jan 2012 23:55
#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