For this Question: Given a string S. Two position i and j of the string are friends if they have the same character. The distance between two friends at positions i and j is defined as |i- j|. Find the sum of distances of all the pairs of friends in the given strings.First line of input contains a single string S.

Constraints:
1 <= |S| <= 1000000
String contains lowercase english letters.Output a single integer which is the sum of distance of all the pair of friends in the given strings.Sample Input
ababa

Sample Output
10

Explanation: Friend pairs - (1, 3) (1, 5) (2, 4) (3, 5), I have written this Solution Code: def findS(s):
    visited= [ 0 for i in range(256)];
    distance =[0 for i in range (256)];
    for i in range(256):
        visited[i]=0;
        distance[i]=0;
    sum=0;
    for i in range(len(s)):
        sum+=visited[ord(s[i])] * i - distance[ord(s[i])];
        visited[ord(s[i])] +=1;
        distance[ord(s[i])] +=i;
    return sum;

if __name__ == '__main__':
    s=input("");
    print(findS(s));, In this Programming Language: Python, Now tell me if this Code is compilable or not?