結果
問題 |
No.436 ccw
|
ユーザー |
![]() |
提出日時 | 2017-05-03 21:43:31 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 79 ms / 2,000 ms |
コード長 | 848 bytes |
コンパイル時間 | 2,753 ms |
コンパイル使用メモリ | 74,992 KB |
実行使用メモリ | 51,156 KB |
最終ジャッジ日時 | 2024-09-14 07:10:36 |
合計ジャッジ時間 | 4,662 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 24 |
ソースコード
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.stream.Stream; import static java.lang.System.in; public class Main { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(in)); String S = reader.readLine(); int Ccounter = 0; int Wcounter = 0; for (int i = 0; i < S.length(); i++) { if (S.charAt(i) == 'c') { Ccounter += 1; } else { Wcounter += 1; } } if (Ccounter > Wcounter) { System.out.println(Wcounter); } else if (Ccounter < Wcounter) { System.out.println(Ccounter-1); } else { System.out.println(Ccounter-1); } } }