fork(1) download
  1. #include<bits/stdc++.h>
  2. typedef long long ll;
  3. using namespace std;
  4. void FASTCODE() {
  5. std::ios_base::sync_with_stdio(0);
  6. cin.tie(0);
  7. cout.tie(0);
  8. }
  9.  
  10. int main() {
  11. FASTCODE();
  12. int n;
  13. cin >> n;
  14. string s;
  15. cin >> s;
  16. int sum=0;
  17. for(int i=0;i<n;i++){
  18. int fre[231]={0};
  19. for(int j=i;j<n;j++){
  20. string x="";
  21. x+=s[j];
  22. if(x.size()>=3){
  23. for(int k=0;k<x.size();k++){
  24. fre[x[k]]++;
  25. }
  26. bool b=true;
  27. for(int f=0;f<=245;f++){
  28. if(fre[f]>1){
  29. b=false;
  30. break;
  31. }
  32. }
  33. if(b==true){
  34. sum++;
  35. }
  36. }
  37. }
  38. }
  39. cout << sum;
  40. return 0;
  41. }
  42.  
Success #stdin #stdout 0.01s 5476KB
stdin
Standard input is empty
stdout
Standard output is empty