#C2543. Decode the Noisy Binary Message
Decode the Noisy Binary Message
Decode the Noisy Binary Message
You are given a set of noisy measurements of a binary message. The original message is a binary string of length \(n\). You are provided with \(m\) binary strings, where each string is a noisy measurement of the original message. For each bit position, determine the most probable bit by taking a vote among the \(m\) measurements. Specifically, for each index \(i\) (where \(0 \le i c_0 \\ 0, & \text{otherwise} \end{cases} \]
Your task is to compute and output the most probable original message.
inputFormat
The input is read from standard input (stdin) and has the following format:
- The first line contains two integers \(n\) and \(m\) separated by a space, where \(n\) is the length of the binary string and \(m\) is the number of measurements.
- The next \(m\) lines each contain a binary string of length \(n\).
outputFormat
Output a single line containing the binary string that represents the most probable original message, as determined by the majority vote on each bit position. In case of a tie at any position, output '0' for that position.
## sample5 3
10101
11100
10100
10100