Question link : https://www.hackerearth.com/practice/basic-programming/input-output/basics-of-input-output/practice-problems/algorithm/two-strings-4/
NOTE: my input : 2 sumut sumu sumit sumit gives output NO NO but it shud give NO YES . //i have problem in this.
MY CODE::
using namespace std;
int main()
{
int t;
cin>>t;
string s1[t],s2[t];
long int a[26]={0},l[t]={0};
for(int i=0;i<t;i++)
{
cin>>s1[i]>>s2[i];
}
for(int k=0;k<t;k++)
{
for(char i=‘a’;i<‘z’;i++)
{
for(int j=0;j<s1[k].size();j++)
{
if(s1[k].at(j)==i){a[i-97]++;}
}
for(int j=0;j<s2[k].size();j++)
{
if(s2[k].at(j)==i){a[i-97]–;}
}
}
for(int i=0;i<26;i++)
{
if(a[i]==0){l[k]++;}
}
}
for(int k=0;k<t;k++)
{
if(l[k]==26){cout<<endl<<“YES”;}
else{cout<<endl<<“NO”;}
}
return 0;
}