+ 1
I don't know why it fail in test 7
#include <iostream> #include<map> using namespace std; char specialChars [7] = {'!', '@', '#', '
#x27;, '%', '&', '*'}; bool hasSpecialChar(string str){ map<char,int> mp; int cnt = 0; for(auto s : str){ mp[s]++; } for(int i = 0; i < 7; ++i){ if(mp.count(specialChars[i])){ cnt += mp[specialChars[i]]; } } return (cnt >= 2); } int main() { string pass; cin >> pass; if(hasSpecialChar(pass) && pass.size() >= 7){ cout << "Strong"; }else{ cout << "Weak"; } return 0; }2 Respuestas
+ 3
The password is valid if it has at least 2 numbers.
https://code.sololearn.com/c9chgaQruw8s
+ 2
SoloProg
Thanks I fixed it