Newton challenge August 2020 4th Problem

@codeguptaji Can you tell what is the problem with my code of Q3? It didn’t passed test case 1 and 2

#include <bits/stdc++.h>
using namespace std;
# define all(v) (v).begin(),(v).end()
# define pi pair<int,int>
# define ll long long
#define MOD 1000000007


int main(){
    std::ios_base :: sync_with_stdio ( false );
    std::cin . tie ( 0 ); std::cout . tie ( 0 );
    string s;
    cin>>s;
	if (s.length()==0) {
		cout<<"0"<<endl;
		return 0;
	}
    vector<int>arr[26];
    ll count=0;
    for (int i=0;i<s.length();i++){
        arr[s[i]-'a'].push_back(i);
    }
    for (int i=0;i<26;i++){
        int l=arr[i].size();
        if (l>1){
            for (int j=1;j<l;j++){
                count+=(j*(l-j)*(abs(arr[i][j]-arr[i][j-1])));
            }
        }
    }
    cout<<count<<endl;
    
    return 0;
}