Solution to the problem number 387 of AceptaelReto - 387.

Any questions do not hesitate to contact.

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

int main()
{
    int n;
    while(scanf("%d",&n)==1 && n!=0)
    {
        cin.ignore();
        map<char,int> M;
        string num;
        for(int i=0; i<n;i++) {
            cin>>num;
            M[num[num.length()-1]]++;}
        int flag = 0,curmax = 0,sol;
        for(auto m:M){
            if(m.second>curmax) {
                flag=0; curmax=m.second; sol=m.first;
            }
            else if(m.second==curmax) flag=1;
        }
        if(flag==0) printf("%c\n",sol);
        else printf("VARIAS\n");
    }
    return 0;
}

Don't miss anything.

Keep in touch with Isaac Lozano Osorio!