Published:
Updated:

https://codeforces.com/problemset/problem/734/A


Solution

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Solution {
    static String returnWhoIsWin(int n, String input) {
        int countA = 0, countD = 0;
        for (int i = 0; i < n; i++) {
            if(input.charAt(i) == 'A') {
                countA++;
            } else {
                countD++;
            }
        }
        if (countA == countD) {
            return "Friendship";
        }
        return (countA > countD) ? "Anton" : "Danik";
    }

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        String input = br.readLine();
        System.out.print(returnWhoIsWin(n, input));
        br.close();
    }
}

Leave a comment