Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- int main()
- {
- char a[20], b[20];
- int n,i;
- freopen("input.txt","r",stdin);
- scanf("%d",&n);
- for(i=1;i<=n;i++){
- scanf("%s %s",a,b);
- if(strcmp(a,b)==0)
- printf("Case %d: Login successful.\n",i);
- else{
- int lena,lenb,j,k=0,cnt=0,cn=0,num=0;
- lena=strlen(a);
- lenb=strlen(b);
- if(lena<lenb)
- printf("Case %d: Wrong password.\n",i);
- else if(lena==lenb){
- for(j=0;j<lena;j++){
- if(((a[j]-64)==(b[j]-96))||((a[j]-96)==(b[j]-64)))
- cnt++;
- }
- if(cnt==lena)
- printf("Case %d: Wrong password. Please, check your caps lock key.\n",i);
- else
- printf("Case %d: Wrong password.\n",i);
- }
- else if(lena>lenb){
- for(j=0;j<lena;j++){
- if((a[j]-48)>=0 && (a[j]-48)<=9){
- num++;
- cnt++;
- cn++;
- continue;
- }
- if(a[j]==b[k])
- cnt++;
- else if(((a[j]-64)==(b[k]-96))||((a[j]-96)==(b[k]-64)))
- cn++;
- k++;
- }
- if(num>0){
- if(cn==lena)
- printf("Case %d: Wrong password. Please, check your caps lock and num lock keys.\n",i);
- else if(cnt==lena)
- printf("Case %d: Wrong password. Please, check your num lock key.\n",i);
- else
- printf("Case %d: Wrong password.\n",i);
- }
- else
- printf("Case %d: Wrong password.\n",i);
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement