結果
問題 | No.2707 Bag of Words Encryption |
ユーザー | mk |
提出日時 | 2024-03-31 13:47:52 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 293 ms / 2,000 ms |
コード長 | 512 bytes |
コンパイル時間 | 2,427 ms |
コンパイル使用メモリ | 76,272 KB |
実行使用メモリ | 48,072 KB |
最終ジャッジ日時 | 2024-09-30 18:25:29 |
合計ジャッジ時間 | 7,606 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 15 |
ソースコード
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); String S = sc.next(); char c = 'A'; String answer = ""; for(int i = 0; i < 26; i++) { String C = String.valueOf((char)(c + i)); int count = 0; for(int j = 0; j < N; j++) { String s = S.substring(j, j + 1); if(C.equals(s)) { count++; } } answer += count; } System.out.println(answer); } }