- 835 名前:login:Penguin mailto:sage [2010/05/23(日) 01:51:49 ID:UUFigVYM]
- >>81
これでいいのかな? import java.io.*; import java.util.*; public class KADAI100523 { public static void main(String[] args) throws IOException { BufferedInputStream bis = new BufferedInputStream(new FileInputStream("input.txt")); long countChar[] = new long[26 * 2]; for (int i = 0; i < countChar.length; i++) countChar[i] = i - 128 + (i < 26 ? 'A' : 'a' + -26); for (int c = bis.read(); c != -1; c = bis.read()) if (c <= 'z' && c >= 'a') countChar[c - 'a' + 26] -= 128; else if (c <= 'Z' && c >= 'A') countChar[c - 'A'] -= 128; Arrays.sort(countChar); for (int i = 0; i < countChar.length; i++) System.out.println("" + (char) ((countChar[i] & 0x7F)) + "\t" + (~countChar[i] >> 7)); } }
|

|