Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

贴个简单易懂的代码

Posted by 452181625 at 2014-06-16 17:28:33 on Problem 2159
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int a[26],b[26];
char s[101];
int main()
{
	int i;
	scanf("%s",s);
	for(i=0;s[i]!='\0';i++)
		a[s[i]-'A']++;
	scanf("%s",s);
	for(i=0;s[i]!='\0';i++)
		b[s[i]-'A']++;
	sort(a,a+26);
	sort(b,b+26);
	for(i=0;i<26;i++)
		if(a[i]!=b[i])
		{
			cout<<"NO\n";
			return 0;
		}
		cout<<"YES\n";
		return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator