mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
Create 2159.cpp
明明是个水题。。。果然还是好久不做题手生了半个小时才弄出来
This commit is contained in:
parent
ef48b33f43
commit
ad580fad11
46
POJ/2159.cpp
Normal file
46
POJ/2159.cpp
Normal file
|
@ -0,0 +1,46 @@
|
|||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <algorithm>
|
||||
using namespace std;
|
||||
|
||||
char linea[1024];
|
||||
char lineb[1024];
|
||||
|
||||
int bina[26];
|
||||
int binb[26];
|
||||
|
||||
int main()
|
||||
{
|
||||
gets(linea);
|
||||
gets(lineb);
|
||||
|
||||
int len=strlen(lineb);
|
||||
for(int i=0;i<len;i++)
|
||||
{
|
||||
bina[linea[i]-'A']++;
|
||||
binb[lineb[i]-'A']++;
|
||||
}
|
||||
|
||||
sort(bina,bina+26);
|
||||
sort(binb,binb+26);
|
||||
|
||||
bool isok=true;
|
||||
for(int i=0;i<26;i++)
|
||||
{
|
||||
if(bina[i]!=binb[i])
|
||||
{
|
||||
isok=false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(isok)
|
||||
{
|
||||
printf("YES\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("NO\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user