Advertisement
erfanul007

Untitled

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