結果

問題 No.1534 おなかがいたい
ユーザー Nzt3
提出日時 2021-06-06 18:13:19
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 9 ms / 2,000 ms
コード長 345 bytes
コンパイル時間 1,736 ms
コンパイル使用メモリ 167,316 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-23 02:17:19
合計ジャッジ時間 2,695 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
int main(){
  string T;
  cin>>T;
  auto itp=T.find("pain");
  if(itp==string::npos){
    cout<<"-1\n";
    return 0;
  }
  int ans=0;
  for(auto i=T.begin();i-T.begin()<itp;i++){
    if(*i=='p'&&*(i+1)=='o'&&*(i+2)=='n')ans++;
  }
  if(ans<2){
    cout<<"-1\n";
  }else{
    cout<<ans-1<<'\n';
  }
}
0