Time Limit: 2 sec / Memory Limit: 1024 MB
配点 : 8 点
注意
この問題に対する言及は、2021/4/24 18:00 JST まで禁止されています。言及がなされた場合、賠償が請求される可能性があります。 試験後に総合得点や認定級を公表するのは構いませんが、どの問題が解けたかなどの情報は発信しないようにお願いします。
問題文
高橋くんは、以下の条件を満たす文字列 S を入力しました。
- S は
past
またはpost
を合計 1 つ以上連結した文字列 - 連結された文字列のうち、
post
は高々 1 つ
あなたへの課題は、連結された文字列のうち、何番目が post
かを求めることです。
制約
- |S| \le 1000
- S は
past
またはpost
を合計 1 つ以上連結した文字列 - 連結された文字列のうち、
post
は高々 1 つ
入力
入力は以下の形式で標準入力から与えられる。
S
出力
もし post
が 1 つ連結されていれば、それがはじめから何番目に連結された文字列かを 1 つの正整数として出力せよ。
post
が 1 つも連結されていなければ、 none
と出力せよ。
入力例 1
pastpastpostpast
出力例 1
3
S= pastpastpostpast
です。 3 番目に連結された文字列が post
です。
入力例 2
pastpastpast
出力例 2
none
S= pastpastpast
です。 post
は 1 つも連結されていません。
Score : 8 points
Warning
Do not make any mention of this problem until April 24, 2021, 6:00 p.m. JST. In case of violation, compensation may be demanded. After the examination, you can reveal your total score and grade to others, but nothing more (for example, which problems you solved).
Problem Statement
Takahashi typed a string S satisfying the following conditions:
- S is a concatenation of one or more strings, each of which is
past
orpost
; - at most one of the concatenated strings is
post
.
Your task is to find out which of the concatenated strings is post
.
Constraints
- |S| \le 1000
- S is a concatenation of one or more strings, each of which is
past
orpost
. - At most one of the concatenated strings is
post
.
Input
Input is given from Standard Input in the following format:
S
Output
If one of the strings concatenated is post
, print a positive integer x such that post
is the x-th string from the left.
Otherwise, print none
.
Sample Input 1
pastpastpostpast
Sample Output 1
3
We have S= pastpastpostpast
, where the third string concatenated is post
.
Sample Input 2
pastpastpast
Sample Output 2
none
We have S= pastpastpast
, where none of the strings concatenated is post
.