59A codeforces - Word


59A codeforces - Word






Solution in C++


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

typedef long long int lli;
#define pii pair<int,int>

int low,upp,n;

string inp,nel,neu;
char th;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    cin>>inp;
    n=inp.size();
    for(int i=0;i<n;i++)
    {
        th=inp[i];
        if(th>='a' && th<='z')low++,nel+=th,neu+=(th-32);
        else if(th>='A' && th<='Z')upp++,neu+=th,nel+=(th+32);
    }
    cout<<((upp==low)?nel:((upp>low)?neu:nel));
    return 0;
}


Share on Google Plus

About Mohamed Sobhi

My name is Mo.Sobhy ,I study at School excelling high school in Ain Shams ,Cairo
My hobbies is programming ,and web development ,playing chess and writing horror stories.
    Blogger Comment
    Facebook Comment

0 التعليقات:

إرسال تعليق