For this Question: Given a string S. Find number of pairs of substrings which are equal.Input contains a string S containing lowercase english alphabet.

Constraints:
1 <= |S| <= 500Print number of pairs of substrings which are equal.Sample Input
ababa

Sample Ouput
7

Explanation
Pairs are:
([0-0], [2-2])
([0-0], [4-4])
([2-2], [4-4])
([1-1], [3-3])
([0-1], [2-3])
([1-2], [3-4])
([0-2], [2-4]), I have written this Solution Code: import java.io.*;
import java.util.*;



class Main {
	public static void main (String[] args) throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String str=br.readLine();
		int n=str.length();

		int count=0;

		for(int i=0;i<n-1;i++){
			for(int j=i+1;j<=n-1;j++){
					if(str.charAt(i)==str.charAt(j)){
						count++;
						int count1=i+1;
						int count2=j+1;
						while(count2<n && str.charAt(count1)==str.charAt(count2)){
							count++;
							count1++;
							count2++;

						}

					}




















			}
		}

		System.out.println(count);
	}
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?