-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsol.cpp
More file actions
executable file
·44 lines (37 loc) · 803 Bytes
/
Copy pathsol.cpp
File metadata and controls
executable file
·44 lines (37 loc) · 803 Bytes
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 <bits/stdc++.h>
using namespace std;
int main()
{
fixed(cout);
cout.precision(9);
string s;
cin >> s;
double whitespace = 0;
double lowercase = 0;
double uppercase = 0;
double symbols = 0;
for (const auto &c : s)
{
if (c == '_')
{
whitespace += 1;
}
else if ('a' <= c && c <= 'z')
{
lowercase += 1;
}
else if ('A' <= c && c <= 'Z')
{
uppercase += 1;
}
else
{
symbols += 1;
}
}
cout << whitespace / (double)s.length() << endl;
cout << lowercase / (double)s.length() << endl;
cout << uppercase / (double)s.length() << endl;
cout << symbols / (double)s.length() << endl;
return 0;
}