問題一覧 > 通常問題

No.2773 Wake up Record 1

レベル : / AI推定難易度 : 111 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (解説公開後に AC するまで非表示) / 解いたユーザー数 177
作問者 : yuusaan / テスター : 👑 amentorimaru 👑 seekworser
お気に入りにしたユーザー ProblemId : 10481 / 自分の提出
問題文最終更新日: 2024-06-06 21:17:17
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 432 (順位表) の他の問題:

Story

Yu-san has been having trouble sleeping lately and keeps waking up many times during the night.

So Yu-san decided to find out when these awakenings happen, in order to improve the quality of sleep.

To that end, Yu-san bought a sleep-recording robot and had it record Yu-san's sleep state.

Your job is to find, on Yu-san's behalf, all the times at which Yu-san woke up.

"I hope this will let me sleep properly at night..."

Problem Statement

Yu-san decided to have a robot keep a sleep record.

The robot measures Yu-san's state from time $1$ to time $N$ and records the sleep record as a string $S$ of $N$ characters.

$S$ consists only of o and x. If the $i$-th character is o, it means that Yu-san is awake at time $i$; if it is x, it means that Yu-san is asleep.

Assume that Yu-san was asleep until just before time $1$. Among the integers $k$ satisfying $2 \leq k \leq N$, output all those such that Yu-san is asleep at time $k-1$ and awake at time $k$, in ascending order.

Input

$N$
$S$

Constraints
  • $1 \leqq N \leqq 10^5$
  • $|S| = N$
  • $N$ is an integer
  • $S$ is a string consisting only of the lowercase English letters o and x
  • The $1$-st character of $S$ is x

Output

Output $2$ lines.

On the $1$-st line, output the number of $k$ satisfying the condition.
On the $2$-nd line, output all $k$ satisfying the condition in ascending order, separated by spaces.

Sample

Sample 1
Input
8
xxoooxxo
Output
2
3 8

The values of $k$ satisfying the condition are $3$ and $8$, which makes $2$ values.

Therefore, output 2, the number of such $k$, on the $1$-st line, and 3 8, the values of $k$ satisfying the condition, on the $2$-nd line.

Sample 2
Input
1
x
Output
0

The number of $k$ satisfying the condition may be $0$.

Sample 3
Input
19
xooxoooxxxxoooxooox
Output
4
2 5 12 16

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。