This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<iostream>
#include<set>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
string A,B;
set<vector<short>> S;
int main()
{
cin>>A>>B;
for(int i=0;i<A.size();i++)
{
vector<short> p(26,0);
for(int j=i;j<A.size();j++)
{
p[A[j]-'a']++;
S.insert(p);
}
}
int ans=0;
for(int i=0;i<B.size();i++)
{
vector<short> p(26,0);
for(int j=i;j<B.size();j++)
{
p[B[j]-'a']++;
auto it=S.find(p);
if(it!=S.end()) ans=max(ans,j-i+1);
}
}
cout<<ans;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |