-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path4a.cc
50 lines (43 loc) · 951 Bytes
/
4a.cc
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
#include <iostream>
#include <vector>
#include <string>
int main()
{
std::string str;
std::vector<int> ssymbols = {0, 0, 0, 0};
std::cin >> str;
if (str.empty() || str.size() < 8 || str.size() > 14)
{
std::cout << "NO" << std::endl;
return 0;
}
for (char c : str)
{
if (c < 33 || c > 126)
{
std::cout << "NO" << std::endl;
return 0;
}
if (c >= 'A' && c <= 'Z')
{
ssymbols[0] += 1;
}
else if (c >= 'a' && c <= 'z')
{
ssymbols[1] += 1;
}
else if (c >= '0' && c <= '9')
{
ssymbols[2] += 1;
}
else
{
ssymbols[3] += 1;
}
}
int zeroes = 0;
for (size_t i = 0; i != ssymbols.size(); ++i)
if (ssymbols[i] == 0)
zeroes++;
std::cout << (zeroes > 1 ? "NO" : "YES") << std::endl;
}