Codeforces 59AWord Solution
Codeforces 59AWord Solution in CPP
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
string a;
int l=0,u=0;
cin>>a;
for(int i=0;i<a.size();i++)
{
if(a[i]>='a'&& a[i]<='z') {
l++;
}
else
u++;
}
if(l>=u){
for(int i=0;i<a.size();i++)//Codeforces 59A.Word Solution
a[i]=tolower(a[i]);
cout<<a<<endl;
}
else
{
for(int i=0;i<a.size();i++)
{
a[i]=toupper(a[i]);
}
cout<<a<<endl;
}
}
Codeforces 59AWord Solution in C
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#define MAX_SIZE 1000
int main()
{
char a[MAX_SIZE];
int l = 0, u = 0;
scanf("%s", a);
for (int i = 0; i < strlen(a); i++)
{
if (islower(a[i]))
{
l++;
}
else
{
u++;
}
}
if (l >= u)
{
for (int i = 0; i < strlen(a); i++)
{
a[i] = tolower(a[i]);
}
printf("%s\n", a);
}
else
{
for (int i = 0; i < strlen(a); i++)
{
a[i] = toupper(a[i]);
}
printf("%s\n", a);
}
return 0;
}