1's Complement of a Binary String

00:00
Easybinarystringbit manipulationlogicfundamentals

The **1's complement** of a binary number is obtained by inverting each of its bits: all `0`s become `1`s, and all `1`s become `0`s. For example: * The 1's complement of `101101` is `010010`. * The 1's complement of `000` is `111`. Implement a function `onesComplement(binaryString)` that takes a string representing a binary number and returns its 1's complement as a string. **Important:** * If the input `binaryString` is empty or contains any character other than `'0'` or `'1'`, your function should return an empty string `""` to indicate invalid input. **Constraints:** * For valid inputs, `1 <= binaryString.length <= 100` * The `binaryString` may contain characters other than `'0'` or `'1'` for invalid test cases.

Examples

Input → "101101"
Output → "010010"
Input → "0000"
Output → "1111"
Input → "1111"
Output → "0000"