A password is called crypto-resistant if it includes both lowercase Latin letters, capital Latin letters, and numbers, and its length must be at least 8 characters. It is required for this password to determine whether it is cryptographically resistant.
- One line is entered, consisting only of Latin letters and numbers. The number of characters in the string does not exceed 100.
- Output the word “YES”, if the specified password is cryptographically strong, and “NO” - otherwise (in capital Latin letters).
Closed due to the fact that off-topic participants Kromster , vp_arth , Harry , Suvitruf ♦ , mymedia 14 Oct '17 at 7:45 .
It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:
- "The message contains only the text of the task, in which there is no description of the problem, or the question is purely formal (" how do I do this task ") . To reopen the question, add a description of the specific problem, explain what does not work, what you see the problem. " - Kromster, vp_arth, Harry, Suvitruf, mymedia
- array of characters + regexp - ishidex2
- I ask the attention of moderators. Suppose, as in this case, the author wants to write a question from scratch. Do I have the right to offer him to solve this issue through personal mail? - HasmikGaryaka
- What exactly does this problem cause? - vp_arth
- @HasmikGaryaka, you can invite him to the chat created here) - vp_arth
- I miss 20 points.)) - HasmikGaryaka
|
1 answer
#include <iostream> #include <string> #include <regex> using namespace std; int main() { for (string s; cin >> s; ) cout << s << " - " << boolalpha << regex_match ( begin(s), end(s), regex("^(?=.*[0-9])(?=.*[az])(?=.*[AZ])[0-9a-zA-Z]{8,}$") ) << endl; return 0; } - Just wondering, do you really think that regulars is the best solution? Or just led the shortest? - pavel
- @pavel, well, it seems like the most porstaya. And in general, regulars are unmversal for all languages, so data is usually validated by regulars. Well, yes, in this case it would be more efficient to make a cycle, but I personally are not interested in writing a solution with a cycle. PS: This is generally one of the answers I gave to get the day 200 points) - Qwertiy ♦
|