CodeForces 59AWord 水题
来源:互联网 发布:python定义json字符串 编辑:程序博客网 时间:2024/04/30 03:19
Vasya is very upset that many people on the Net mix uppercase and lowercase letters in one word. That's why he decided to invent an extension for his favorite browser that would change the letters' register in every word so that it either only consisted of lowercase letters or, vice versa, only of uppercase ones. At that as little as possible letters should be changed in the word. For example, the word HoUse must be replaced with house, and the word ViP — with VIP. If a word contains an equal number of uppercase and lowercase letters, you should replace all the letters with lowercase ones. For example, maTRIx should be replaced by matrix. Your task is to use the given method on one given word.
The first line contains a word s — it consists of uppercase and lowercase Latin letters and possesses the length from 1 to 100.
Print the corrected word s. If the given word s has strictly more uppercase letters, make the word written in the uppercase register, otherwise - in the lowercase one.
HoUse
house
ViP
VIP
maTRIx
matrix
判断大小写字母
#include <iostream> #include <cstdio>#include <stdio.h>#include <cstdlib>#include <cmath>#include <algorithm>#include <climits>#include <cstring>#include <string>#include <set>#include <map>#include <queue>#include <stack>#include <vector>#include <list>#define rep(i,m,n) for(i=m;i<=n;i++)#define rsp(it,s) for(set<int>::iterator it=s.begin();it!=s.end();it++)const int inf_int = 2e9;const long long inf_ll = 2e18;#define inf_add 0x3f3f3f3f#define mod 1000000007#define vi vector<int>#define pb push_back#define mp make_pair#define fi first#define se second#define pi 3.1415927#define pii pair<int,int>#define Lson L, mid, rt<<1#define Rson mid+1, R, rt<<1|1const int maxn=5e2+10;using namespace std;typedef long long ll;typedef unsigned long long ull; inline int read(){int ra,fh;char rx;rx=getchar(),ra=0,fh=1;while((rx<'0'||rx>'9')&&rx!='-')rx=getchar();if(rx=='-')fh=-1,rx=getchar();while(rx>='0'&&rx<='9')ra*=10,ra+=rx-48,rx=getchar();return ra*fh;}//#pragma comment(linker, "/STACK:102400000,102400000")ll gcd(ll p,ll q){return q==0?p:gcd(q,p%q);}ll qpow(ll p,ll q){ll f=1;while(q){if(q&1)f=f*p;p=p*p;q>>=1;}return f;}string s;int ct1,ct2;int main(){ios::sync_with_stdio(false);cin >> s;for(int i=0;i<s.size();i++){if(s[i]>='A'&&s[i]<='Z')ct1++;elsect2++; }if(ct1>ct2){for(int i=0;i<s.size();i++){if(s[i]>='a'&&s[i]<='z')s[i]-=32;}}else{for(int i=0;i<s.size();i++){if(s[i]>='A'&&s[i]<='Z')s[i]+=32;}}cout<<s<<endl; return 0;}
- CodeForces 59AWord 水题
- Infoworld bossie 2016 best open source aword 2016 开源软件获奖项目
- CodeForces水题
- 【水题】CodeForces
- 【水题】CodeForces
- CodeForces 59B
- CodeForces 59BFortune Telling
- Codeforces Gym100286I iSharp (水题)
- CodeForces 483B(水题)
- codeforces 617B 水题~
- 水题CodeForces 120C
- codeforces 676A (水题)
- codeforces 685A (水题)
- codeforces 589I(水题)
- Codeforces Divisibility【水题】
- codeforces 691B 水题
- codeforces 733D (水题)
- CodeForces 352B 水题
- Python爬虫/文本处理/科学计算/机器学习——工具包总结
- 南邮离散数学实验三-偏序关系中盖住关系的求取及格论中有补格的判定
- 2016 总结记
- 关于mysql中由于类型转换导致索引无法使用的问题
- LeetCode 231. Power of Two
- CodeForces 59AWord 水题
- Spring自动检测并装配bean
- 远程调用的几种方式
- 【PAT】1004. Counting Leaves (30)
- 在linux环境中编译JNI的文件为.so包
- 积分
- CodeForces 59BFortune Telling
- Android嵌套滑动控件的冲突解决和ViewPager适配当前子控件高度不留空白的办法
- FreeRTOS之配置详解、裁剪(FreeRTOSConfig.h)