fork download
  1. int i,j,k;
  2. int ans=0;
  3. string a,b;
  4. int n=s.size();
  5. map<string,int>mp;
  6. for(i=0;i<n;i++)
  7. {
  8. for(j=1;j<=n-i;j++)
  9. {
  10. a=s.substr(i,j);
  11. sort(a.begin(),a.end());
  12. mp[a]++;
  13. }
  14. }
  15.  
  16. for(auto x:mp)
  17. {
  18. k=x.second;
  19. ans+=(k*(k-1))/2;
  20. }
  21.  
  22. return ans;
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:3:5: error: ‘string’ does not name a type
     string a,b;
     ^~~~~~
prog.cpp:4:11: error: ‘s’ was not declared in this scope
     int n=s.size();
           ^
prog.cpp:5:5: error: ‘map’ does not name a type
     map<string,int>mp;
     ^~~
prog.cpp:6:5: error: expected unqualified-id before ‘for’
     for(i=0;i<n;i++)
     ^~~
prog.cpp:6:13: error: ‘i’ does not name a type
     for(i=0;i<n;i++)
             ^
prog.cpp:6:17: error: ‘i’ does not name a type
     for(i=0;i<n;i++)
                 ^
prog.cpp:16:5: error: expected unqualified-id before ‘for’
     for(auto x:mp)
     ^~~
prog.cpp:22:1: error: expected unqualified-id before ‘return’
 return ans;
 ^~~~~~
stdout
Standard output is empty