【初心者スレ】Ubuntu Linux 51at LINUX
【初心者スレ】Ubuntu Linux 51 - 暇つぶし2ch835:login:Penguin
10/05/23 01:51:49 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));
}
}


次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch