Advertisement
erfanul007

LA 5047 wa

Nov 30th, 2018
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3.  
  4. int main()
  5. {
  6. char a[20], b[20];
  7. int n,i;
  8. freopen("input.txt","r",stdin);
  9. scanf("%d",&n);
  10. for(i=1;i<=n;i++){
  11. scanf("%s %s",a,b);
  12. int lena,lenb,j,k=0,cnt=0,cn=0,num=0;
  13. lena=strlen(a);
  14. lenb=strlen(b);
  15.  
  16. if(lena<lenb)
  17. printf("Case %d: Wrong password.\n",i);
  18.  
  19. else if(lena==lenb){
  20. for(j=0;j<lena;j++){
  21. if(a[j]==b[j])
  22. cnt++;
  23. if(((a[j]-64)==(b[j]-96))||((a[j]-96)==(b[j]-64)))
  24. cn++;
  25. }
  26. if(cnt==lena)
  27. printf("Case %d: Login successful.\n");
  28.  
  29. else if(cn==lena)
  30. printf("Case %d: Wrong password. Please, check your caps lock key.\n",i);
  31.  
  32. else
  33. printf("Case %d: Wrong password.\n",i);
  34. }
  35. else if(lena>lenb){
  36. for(j=0;j<lena;j++){
  37. if((a[j]-48)>=0 && (a[j]-48)<=9){
  38. num++;
  39. cnt++;
  40. cn++;
  41. continue;
  42. }
  43. if(a[j]==b[k])
  44. cnt++;
  45.  
  46. else if(((a[j]-64)==(b[k]-96))||((a[j]-96)==(b[k]-64)))
  47. cn++;
  48.  
  49. k++;
  50. }
  51. if(num>0){
  52. if(cn==lena)
  53. printf("Case %d: Wrong password. Please, check your caps lock and num lock keys.\n",i);
  54.  
  55. else if(cnt==lena)
  56. printf("Case %d: Wrong password. Please, check your num lock key.\n",i);
  57.  
  58. else
  59. printf("Case %d: Wrong password.\n",i);
  60. }
  61. else
  62. printf("Case %d: Wrong password.\n",i);
  63. }
  64. }
  65. return 0;
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement