LightOJ 1338 - Hidden Secret!
/*/*Next Codeforces Round #354 (Div. 2)*/
#include<bits/stdc++.h>
//#include<cstdio>
//#include<iostream>
//#include<algorithm>
//#include<vector>
//#include<cstring>
//#include<cmath>
//#include<map>
using namespace std;
#define fast ios_base::sync_with_stdio(false)
#define bfast cin.tie(0)
#define outs(x) cout << x << " "
#define outn(x) cout << x << "\n"
#define sf scanf
#define pf printf
#define nl puts("")
//#define i64 long long
#define high 105
typedef long long LL;
typedef vector<int>vii;
typedef vector<LL>vll;
int main()
{
fast;
int t , tc=0, i, eklen, duilen;
string ek, dui , first="" , second="";
cin >> t;
cin.ignore();
while(t--)
{
getline(cin , ek);
getline(cin, dui);
first = second = "";
eklen=ek.length();
duilen = dui.length();
for(i=0; i<eklen; i++)
{
if(ek[i]>='A' and ek[i]<='Z')
{
//ar[alen++] = (char)ek[i]+32;
first+=(char)ek[i]+32;
}
else if(ek[i]>='a' and ek[i]<='z')
{
//ar[alen++] = ek[i];
first+=ek[i];
}
}
for(i=0; i<duilen; i++)
{
if(dui[i]>='A' and dui[i]<='Z')
{
//br[blen++] = (char)dui[i]+32;
second+=(char)dui[i]+32;
}
else if(dui[i]>='a' and dui[i]<='z')
{
//br[blen++] = dui[i];
second+=dui[i];
}
}
sort(first.begin(), first.end());
sort(second.begin(), second.end());
cout << "Case " << ++tc << ": ";
if(first == second) cout << "Yes\n";
else cout << "No\n";
}
return 0;
}
#include<bits/stdc++.h>
//#include<cstdio>
//#include<iostream>
//#include<algorithm>
//#include<vector>
//#include<cstring>
//#include<cmath>
//#include<map>
using namespace std;
#define fast ios_base::sync_with_stdio(false)
#define bfast cin.tie(0)
#define outs(x) cout << x << " "
#define outn(x) cout << x << "\n"
#define sf scanf
#define pf printf
#define nl puts("")
//#define i64 long long
#define high 105
typedef long long LL;
typedef vector<int>vii;
typedef vector<LL>vll;
int main()
{
fast;
int t , tc=0, i, eklen, duilen;
string ek, dui , first="" , second="";
cin >> t;
cin.ignore();
while(t--)
{
getline(cin , ek);
getline(cin, dui);
first = second = "";
eklen=ek.length();
duilen = dui.length();
for(i=0; i<eklen; i++)
{
if(ek[i]>='A' and ek[i]<='Z')
{
//ar[alen++] = (char)ek[i]+32;
first+=(char)ek[i]+32;
}
else if(ek[i]>='a' and ek[i]<='z')
{
//ar[alen++] = ek[i];
first+=ek[i];
}
}
for(i=0; i<duilen; i++)
{
if(dui[i]>='A' and dui[i]<='Z')
{
//br[blen++] = (char)dui[i]+32;
second+=(char)dui[i]+32;
}
else if(dui[i]>='a' and dui[i]<='z')
{
//br[blen++] = dui[i];
second+=dui[i];
}
}
sort(first.begin(), first.end());
sort(second.begin(), second.end());
cout << "Case " << ++tc << ": ";
if(first == second) cout << "Yes\n";
else cout << "No\n";
}
return 0;
}
Comments
Post a Comment