QOJ.ac

QOJ

Süre Sınırı: 1 s Bellek Sınırı: 256 MB Toplam puan: 100

#11099. Key Knocking

İstatistikler

Goran is recovering from his knee surgery and is experimenting with a smart card used for storing cryptographic keys. In this problem, a key is a bitstring of size $3n$ where $n$ is a positive integer. Particular bits of the key are indexed with integers $1$ through $3n$ left to right. Weight of a key is the number of pairs of different neighbouring bits increased by one. For example, the weight of the key “000” is $1$, while the weight of the key “011010100” is $7$.

He has discovered that he can tamper with the key by sending small jolts of electricity through the circuits of the smart card. In particular, he can reliably perform the following operation: pick two arbitrary neighbouring bits of the key and flip both of them. For example, one operation can change the key “000” to “110”.

Given a key of size $3n$ find any sequence of at most $n$ operations that transforms the given key to a key of weight at least $2n$. You may assume that a solution always exists.

Input

The first line contains a string consisting of digits “0” and “1” — the initial key. The length of the key is $3n$ where $n$ is a positive integer such that $1 \le n \le 100\,000$.

Output

The first line should contain an integer $m$ where $0 \le m \le n$ — the number of operations in your solution. The following line should contain $m$ integers $a_1,a_2,\ldots,a_m$ describing your solution. The number $a_k$ is the index of the left one of two bits being flipped in the $k$-th step.

If the initial key already has weight at least $2n$ you may output only the integer $0$.

Examples

Input 1

000000000

Output 1

3
2 5 6

Input 2

111001000111

Output 2

2
3 9

Input 3

010101

Output 3

0

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.