当前位置:   article > 正文

Coder-Strike 2014 - Qualification Round——A. Password Check_you have probably registered on internet sites man

you have probably registered on internet sites many times. and each time you

You have probably registered on Internet sites many times. And each time you should enter your invented password. Usually the registration form automatically checks the password's crypt resistance. If the user's password isn't complex enough, a message is displayed. Today your task is to implement such an automatic check.

Web-developers of the company Q assume that a password is complex enough, if it meets all of the following conditions:

  • the password length is at least 5 characters;
  • the password contains at least one large English letter;
  • the password contains at least one small English letter;
  • the password contains at least one digit.

You are given a password. Please implement the automatic check of its complexity for company Q.

Input

The first line contains a non-empty sequence of characters (at most 100 characters). Each character is either a large English letter, or a small English letter, or a digit, or one of characters: "!", "?", ".", ",", "_".

Output

If the password is complex enough, print message "Correct" (without the quotes), otherwise print message "Too weak" (without the quotes).

Sample test(s)
input
abacaba
output
Too weak
input
X12345
output
Too weak
input
CONTEST_is_STARTED!!11
output
Correct
设置密码题
  1. #include<iostream>
  2. #include <cstring>
  3. using namespace std;
  4. int main()
  5. {
  6. string s;
  7. int len,sum1,sum2,sum3;
  8. while(cin>>s)
  9. {
  10. sum1=sum2=sum3=0;
  11. len=s.size();
  12. if(len<5)
  13. {
  14. cout<<"Too weak"<<endl;
  15. continue;
  16. }
  17. for(int i=0;i<len;i++)
  18. {
  19. if(s[i]>='A'&&s[i]<='Z')
  20. sum1++;
  21. if(s[i]>='a'&&s[i]<='z')
  22. sum2++;
  23. if(s[i]>='0'&&s[i]<='9')
  24. sum3++;
  25. }
  26. if(sum1!=0&&sum2!=0&&sum3!=0)
  27. {
  28. cout<<"Correct"<<endl;
  29. }
  30. else
  31. cout<<"Too weak"<<endl;
  32. }
  33. return 0;
  34. }


声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/空白诗007/article/detail/913907
推荐阅读
相关标签
  

闽ICP备14008679号