AcWing 3955. 统一大小写
原题链接
简单
作者:
代码人生
,
2022-08-26 16:07:31
,
所有人可见
,
阅读 144
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int t;
string s;
bool check(string s){
int x=0,y=0;
for(int i=0;i<s.size();i++){
if(s[i] >= 'A' && s[i] <= 'Z') x++;
else y++;
}
return x > y;
}
int main()
{
cin >> t;
while(t -- ){
cin >> s;
if(check(s)){
for(int i=0;i<s.size();i++){
if(s[i] >= 'a' && s[i] <= 'z'){
s[i] = s[i] - 32;
}
}
}
else{
for(int i=0;i<s.size();i++){
if(s[i] >= 'A' && s[i] <= 'Z'){
s[i] = tolower(s[i]);
}
}
}
cout << s << endl;
}
return 0;
}