Subscribe Us

Responsive Advertisement

Advertisement

URI Online Judge | 2949 The Fellowship of the Ring solution in cpp

 

uri 2949 solution in cpp

by ujjal roy



#include<bits/stdc++.h>

using namespace std;

main()

{

    string s1,s2;

    int x=0,h=0,e=0,a=0,m=0,t;

    cin>>t;

    while(t--)

    {

        cin>>s1>>s2;


        if(s2[0]=='X') x++;

        else if(s2[0]=='H') h++;

        else if(s2[0]=='E') e++;

        else if(s2[0]=='A') a++;

        else if(s2[0]=='M') m++;


    }

    cout<<x<<" Hobbit(s)"<<endl;

    cout<<h<<" Humano(s)"<<endl;

    cout<<e<<" Elfo(s)"<<endl;

    cout<<a<<" Anao(s)"<<endl;

    cout<<m<<" Mago(s)"<<endl;


}


Post a Comment

0 Comments