結果
問題 |
No.1534 おなかがいたい
|
ユーザー |
![]() |
提出日時 | 2022-02-23 21:55:58 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 20 ms / 2,000 ms |
コード長 | 427 bytes |
コンパイル時間 | 8,424 ms |
コンパイル使用メモリ | 362,160 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-22 14:23:38 |
合計ジャッジ時間 | 8,205 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 19 |
ソースコード
import std; void main() { string S = readln.chomp; auto r = regex([r"pon|pain"]); auto T = S.splitter!(Yes.keepSeparators)(r); bool isOK = true; string a = "pon", b = "pain"; int res, num = -1; foreach (t; T) { if (t == a) ++num; else if (t == b && isOK) { res = max(res, num); isOK = false; } } if (res == 0) res = -1; res.writeln; }