-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSolution-CF59-D2-A
45 lines (40 loc) · 1.32 KB
/
Solution-CF59-D2-A
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <iostream>
#include <string.h>
using namespace std;
int main(){
char input_string[100];
int numUpper=0,numLower=0,length_of_string=0;
cin>>input_string;
length_of_string=strlen(input_string);
for(int index1=0;index1<100 && input_string[index1]!='\0';index1++){
if(int(input_string[index1])>=65 && int(input_string[index1])<91){
numUpper+=1;
}
else if(int(input_string[index1])>=97 && int(input_string[index1])<123){
numLower+=1;
}
}
if(numLower>=numUpper){
for(int index2=0;index2<length_of_string && input_string[index2]!='\0';index2++){
if(int(input_string[index2])>=65 && int(input_string[index2])<91){
input_string[index2]+=32;
cout<<char(input_string[index2]);
}
else
cout<<input_string[index2];
}
cout<<endl;
}
else if(numLower<numUpper){
for(int index2=0;index2<length_of_string && input_string[index2]!='\0';index2++){
if(int(input_string[index2])>=97 && int(input_string[index2])<123){
input_string[index2]-=32;
cout<<char(input_string[index2]);
}
else
cout<<input_string[index2];
}
cout<<endl;
}
return 0;
}