Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // _ _
- // __ _ _ _| |_| |__ ___ _ __
- // / _` | | | | __| '_ \ / _ \| '__|
- // | (_| | |_| | |_| | | | (_) | |
- // \__,_|\__,_|\__|_| |_|\___/|_|
- // _ _ _ _
- // __ _ _ __ (_) | __ __ _| | ____ _ ___| |__
- // / _` | '_ \| | |/ / / _` | |/ / _` / __| '_ \
- // | (_| | | | | | < | (_| | < (_| \__ \ | | |
- // \__,_|_| |_|_|_|\_\ \__,_|_|\_\__,_|___/_| |_|
- #include<bits/stdc++.h>
- using namespace std;
- #define flush cin.ignore(numeric_limits<streamsize>::max(),'\n')
- #define fasterio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
- #define NL cout<<endl;
- #define pi acos(-1.0) //3.1415926535897932384626
- #define dpoint(x) fixed<<setprecision(x)
- #define debug(x) cout<<x<<endl;
- #define gcd(a,b) __gcd(a,b);
- #define lcm(x,y) (a * (b / gcd(a, b)));
- #define pb push_back
- #define mx 100000005
- typedef long long int ll;
- typedef double dl;
- typedef unsigned long long ul;
- // --------------------------Pre made Functions & Proto Type--------------------------//
- template <class T> T digitsum(T n){T sum=0;while(n!=0){sum+=n%10;n/=10;}return sum;}
- string pass, in, test;
- bool num_checker()
- {
- int pass_digit=0, in_digit=0;
- for(int i=0; i<pass.size(); i++)
- {
- if(isdigit(pass[i]))pass_digit++;
- }
- for(int i=0; i<in.size(); i++)
- {
- if(isdigit(in[i]))in_digit++;
- }
- if(pass_digit>0 && in_digit==0)
- return true;
- else return false;
- }
- bool caps_checker()
- {
- for(int i=0; i<pass.size(); i++)
- {
- if( !isdigit(pass[i]) )test+=pass[i];
- }
- for(int i=0; i<test.size(); i++)
- {
- if( (test[i]>='A' && test[i]<='Z') && (in[i]>='a' && in[i]<='b'))
- {
- char c = toupper(in[i]);
- if(test[i] == c )continue;
- else return false;
- }
- else if( (test[i]>='a' && test[i]<='z') && (in[i]>='A' && in[i]<='Z'))
- {
- char c = tolower(in[i]);
- if(test[i] == c )continue;
- else return false;
- }
- else if(test[i]==in[i])continue;
- else return false;
- }
- return true;
- }
- int main()
- {
- #ifdef EXTRA_8
- clock_t tStart = clock();
- freopen("input.txt","r",stdin);
- freopen("out.txt","w",stdout);
- #endif
- int t;
- cin>>t;
- for(int k=1; k<=t; k++)
- {
- cin>>pass>>in;
- cout<<"Case "<<k<<": ";
- if(pass.size() == in.size())
- {
- bool flg = true;
- for(int i=0; i<pass.size(); i++)
- {
- if(pass[i]==in[i])continue;
- else {flg = false; break;}
- }
- if(flg)cout<<"Login successful."<<endl;
- else {
- int x = num_checker(); int y = caps_checker();
- if(x == 1 && y == 1)cout<<"Wrong password. Please, check your caps lock and num lock keys."<<endl;
- else if(x==1)cout<<"Wrong password. Please, check your num lock keys."<<endl;
- else if(y==1)cout<<"Wrong password. Please, check your caps lock keys."<<endl;
- else cout<<"Wrong password."<<endl;
- }
- }
- else cout<<"Wrong password."<<endl;
- }
- #ifdef EXTRA_8
- fprintf(stderr, "\n>> Runtime: %.10fs\n", (double) (clock() - tStart) / CLOCKS_PER_SEC);
- #endif
- return 0;
- }
- // _____ _ _ _ ___ __
- // | ___|__ _ __ | |_| |__ ___ | | _____ _____ / _ \ / _|
- // | |_ / _ \| '__| | __| '_ \ / _ \ | | / _ \ \ / / _ \ | | | | |_
- // | _| (_) | | | |_| | | | __/ | |__| (_) \ V / __/ | |_| | _|
- // |_| \___/|_| \__|_| |_|\___| |_____\___/ \_/ \___| \___/|_|
- // ____ ____
- // / ___| _ \
- // | | | |_) |
- // | |___| __/
- // \____|_|
- //
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement