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;
- scanf("%d",&n);
- for(i=1;i<=n;i++){
- scanf("%s %s",a,b);
- 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]==b[j])
- cnt++;
- if(((a[j]-64)==(b[j]-96))||((a[j]-96)==(b[j]-64)))
- cn++;
- }
- if(cnt==lena)
- printf("Case %d: Login successful.\n");
- else if(cn==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;
- }
Add Comment
Please, Sign In to add comment