Codeforces solution 734A Anton and Danik

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,a=0,d=0;
    char ch;
    cin>>n;
    for(int i=1; i<=n; i++)
    {
        cin>>ch;
        if(ch=='A')
        {
            a++;
        }
        else
        {
            d++;
        }
    }
    if(a>d)
    {
        cout<<"Anton"<<endl;

    }
    else if(d>a)
    {
        cout<<"Danik"<<endl;
    }
    else if(a==d)
    {
        cout<<"Friendship"<<endl;
    }

}

Comments

Popular posts from this blog

Codeforces Solution 230B T-primes

Uri Solution 2747 Output 1