Relative Frequency by mulder_fbi

//enum M{M;System z;int b,t;float u,v;{try{b=t=z.in.read();for(;b>=0;b=z.in.read()){if(b==t)++u;++v;if(b==10){z.out.printf("%.6f\n",u/(v-1));u=v=0;t=b;}}}catch(Exception e){}}}\x0d
import java.util.*;enum M{M;System z;float i,j;{for(Scanner s=new Scanner(z.in);s==s;){String t=s.nextLine();j=t.length()-2;char c=t.charAt(0);for(i=-1;t.contains(""+c);t=t.replaceFirst(""+c,""))++i;z.out.printf("%.6f\n",i/j);}}}

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page