For this Question: Given a string s, find the minimum number of changes required to it so that all substrings of the string become distinct.

Note: length of string is atmost 26.The first line contains an integer T, number of test cases. For each testcase there is only one line containing s atmost 26 characters.

1 <= T <= 100
1 <= |s| <= 26For each testcase in new line, print the minimum number of changes to the string.Sample Input:
3
aab
aebaecedabbee
ab

Sample Output:
1
8
0

Explanation:
Testcase 1: If we change one instance of 'a' to any character from 'c' to 'z', we get all distinct substrings.
Testcase 2: We need to change 2 a's, 2 b's and 4 e's to get distinct substrings.
Testcase 3: As no change is required hence 0., I have written this Solution Code: import java.io.*;
import java.util.*;



class Main {
	public static void main (String[] args) throws Exception {
		InputStreamReader ir = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(ir);

		int n = Integer.parseInt(br.readLine());



		for(int i=0; i<n; i++) {
			int[] arr = new int[26];
			int ans = 0;
			String s = br.readLine();

			int l = s.length();

			for (int j=0; j<l; j++) {
				int c = s.charAt(j) - 97;
				arr[c]++;
			}

			for (int k=0; k<26; k++) {
				if(arr[k]>1) {
					int val = arr[k];

					ans += val-1;
				}
			}
			System.out.println(ans);
		}
	}
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?