fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. bool a(string s,string t){
  4. if(s.size()!=t.size()) return false;
  5. unordered_map<char,int>m1,m2;
  6. for(int i=0;i<s.size();i++){
  7. m1[s[i]]++;
  8. m2[t[i]]++;
  9. }
  10. return m1==m2;
  11. }
  12. int main(){
  13. string s="listen",t="silent";
  14. cout<<(a(s,t)?"yes":"no")<<"\n";
  15. return 0;
  16. }
  17.  
Success #stdin #stdout 0s 5288KB
stdin
Standard input is empty
stdout
yes