import java.util.*;
import java.math.*;
//rename the class name before submitting
public class GooseTattarrattatDiv2 {
public static void main(String[] args) {
GooseTattarrattatDiv2 obj = new GooseTattarrattatDiv2();
System.out.println(
obj.getmin(
""
));
}
public int getmin(String S) {
int[] cnt = new int[26];
for (int i = 0; i < S.length(); i++) {
int c = S.charAt(i) - 'a';
cnt[c] += 1;
}
int maxCnt = 0;
for (int i = 0; i < cnt.length; i++) {
maxCnt = Math.max(maxCnt, cnt[i]);
}
return S.length() - maxCnt;
}
}
First Thanks for your efforts
ReplyDeleteSecond Please can you provide problem statement for each post