QOJ.ac

QOJ

حد الوقت: 1.0 s حد الذاكرة: 1024 MB مجموع النقاط: 100 قابلة للهجوم ✓

#15313. Sostituzione

الإحصائيات

Data una stringa binaria $s$ di lunghezza $n$ (stringa $01$), devi sostituire un carattere in $s[2 \ldots n - 1]$ con $\oplus$, in modo che il valore finale dell'espressione sia il più grande possibile.

$\oplus$ rappresenta l'operazione XOR binaria. Dopo la sostituzione, entrambi i lati di $\oplus$ vengono trattati come numeri binari.

Input

Un singolo caso di test contiene più set di dati.

La prima riga dell'input è il numero di set di dati $T$ ($1 \le T \le 10^5$), che rappresenta il numero di set di dati in questo caso di test.

Per ogni set di dati, c'è una riga contenente una stringa binaria $s$ ($3 \le |s| \le 5 \cdot 10^5$).

È garantito che in un singolo caso di test $\sum |s| \le 5 \cdot 10^5$.

Output

Per ogni set di dati, stampa una riga contenente una stringa binaria che rappresenta il risultato massimo in forma binaria (la stringa numerica non può contenere $0$ iniziali, tranne nel caso della singola cifra $0$).

Esempi

Input 1

5
010
0110
1000
10101
01000

Output 1

0
10
10
100
10

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.