-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalphabet_spam.cpp
70 lines (51 loc) · 1.06 KB
/
alphabet_spam.cpp
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<cmath>
using namespace std;
int bSearch(vector<int> a, int x){
int size = a.size();
int l = 0;
int r = size - 1;
int result = -1;
while(l <= r){
int m = (l + r) /2;
if(a[m] <= x){
l = m + 1;
result = m;
}
else{
r = m -1;
}
}
return result;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
string input;
cin >> input;
float under_score = 0;
float lower = 0;
float uper = 0;
float symbol = 0;
float size = input.size();
for(const auto & x : input){
if(islower(x)){
lower++ ;
}
if(x == '_'){
under_score++;
}
if(isupper(x)){
uper++;
}
}
symbol = size - uper - under_score - lower;
cout << under_score / size << "\n";
cout << lower / size << "\n";
cout << uper / size << "\n";
cout << symbol / size << "\n";
return 0;
}