-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathnew-password.cpp
41 lines (36 loc) · 1 KB
/
new-password.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
#include <bits/stdc++.h>
using namespace std;
int itr = 1;
void execute() {
bool isProperUpper = false;
bool isProperLower = false;
bool isProperDigit = false;
bool isProperSpecial = false;
unordered_set<char> specials {'#', '@', '*', '&'};
int len;
cin>>len;
string s;
cin>>s;
for(auto c: s) {
if (c >= 65 && c <= 90) isProperUpper = true;
else if (c >= 97 && c <= 122) isProperLower = true;
else if (c >= 48 && c <= 57) isProperDigit = true;
else if (specials.count(c)) isProperSpecial = true;
}
if (!isProperUpper) s += 'A';
if (!isProperLower) s += 'a';
if (!isProperDigit) s += '1';
if (!isProperSpecial) s += '#';
while(s.length() < 7) s += 'a';
cout<<"Case #"<<itr<<": "<<s<<endl;
itr++;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
freopen("input.txt", "r", stdin);
int no_of_test_cases = 1;
cin >> no_of_test_cases;
while (no_of_test_cases--) execute();
return 0;
}