HDACM2131
水题,注意精度和大小写即可
import java.util.Scanner;public class Main {public static void main(String[] args) {Scanner sc = new Scanner(System.in);while (sc.hasNext()) {String str = sc.nextLine();str = str.toLowerCase();char c[] = str.toCharArray();int count = 0;for (int i = 2; i < c.length; i++) {if (c[0]==c[i]) {count++;}}System.out.printf("%.5f",(1.0*count/(c.length-2)));System.out.println();}}
}