Codeforces 734A A. Anton and Danik Solution

Solve in C++:

#include<bits/stdc++.h>
using namespace std;

int main()
{
    int a=0,d=0,t,i,l;
    char s[100001];
    while(cin>>t)
    {
        for(i=0; i<t; i++)
        {
            cin>>s[i];
            if(s[i]=='A')
                a++;
            else if(s[i]=='D')
                d++;
        }
        if(a>d)
            cout<<"Anton"<<endl;
        else if(d>a)
            cout<<"Danik"<<endl;
        else if(a==d)
            cout<<"Friendship"<<endl;
    a=0,d=0;

    }

}

No comments

Most View Post

Recent post

RESTful APIs with CRUD Operations in Laravel 12| (2025)

  RESTful APIs serve as the foundation of modern web development. They follow a set of rules called Representational State Transfer (REST) t...

Powered by Blogger.