A Word

Time Limit: 2000MS Memory Limit: 262144K 64bit IO Format: %I64d& %I64u

[Submit [GoBack  [Status]

Description

Vasya is very upset that many people on the Net mix uppercaseand lowercase letters in one word. That's why he decided to inventan extension for his favorite browser that would change theletters' register in every word so that it either only consisted oflowercase letters or, vice versa, only of uppercase ones. At thatas little as possible letters should be changed in the word. Forexample, theword HoUse must bereplaced with house, and theword ViP —with VIP. If a word contains an equalnumber of uppercase and lowercase letters, you should replace allthe letters with lowercase ones. Forexample, maTRIx shouldbe replaced by matrix. Your task isto use the given method on one given word.

Input

The first line contains a word s — it consistsof uppercase and lowercase Latin letters and possesses the lengthfrom 1 to 100.

Output

Print the corrected word s. If the givenword s has strictlymore uppercase letters, make the word written in the uppercaseregister, otherwise - in the lowercase one.

Sample Input

Input
HoUse

Output
house

Input
ViP

Output
VIP

Input
maTRIx

Output
matrix




#include<iostream>
using namespace std;
int main()
{
        char str[105];
        int i,j;
        int count1,count2;
        while(gets(str))
        {

        for(i=0;i<strlen(str);i++)
        {
                if(str[i]>='A'&&str[i]<='Z')   count1++;
                else     count2++;
        }
                if(count2>=count1)
                        for(j=0;j<strlen(str);j++)
                        {
                                if(str[j]>='A'&&str[j]<='Z')
                                         str[j]=str[j]+32;
                        }
                        else  
                                        for(j=0;j<strlen(str);j++)
                        {
                                if(str[j]>='a'&&str[j]<='z')
                                         str[j]=str[j]-32;
                        }

     for(j=0;j<strlen(str);j++)
            cout<<str[j];
             cout<<endl;
        }
        return 0;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值