Binary representation of previous number
Submissions: 779   Accuracy:

26.73%

  Difficulty: Basic   Marks: 1

Given a binary input that represents binary representation of positive number N, the task is to find binary representation of N-1. It may be assumed that input binary number is greater than 0. The binary input may or may not fit even in unsigned long long int.

Input:
The first line of input contains an integer T,  denoting the number of test cases. Then T test cases follow. Each test case contains binary representation of the positive number N.

Output:
For each test case, print the binary representation of number N-1.

Constraints:
1<=T<=500
1<=|Number.size|<=103

Example:
Input:

2
11
111
Output:
10
110

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Arun Tyagi
Author: arun03


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.