Strings

All submissions for this problem are available.
Given a binary number $S$ containing only of 1's and 0's, find two binary numbers $A$ and $B$ such that the sum of the number of 1's in $A$ and $B$ is minimum and $AB=S$. If there are many such numbers, you can print any. The binary number $S$ has some properties. See the Constraints section for details. ###Input:  The only line of input contains a single binary number $S$ without leading zeroes. ###Output: Print two numbers $A$ and $B$ in one line without leading zeroes. If any number is zero, just print $0$. ###Constraints  $2 \leq$ number of bits in $S \leq 10^6$  The string $S$ has at least 1 one and 1 zero and has exactly two parts: all 1's followed by all 0's. ###Sample Input: 1110000 ###Sample Output: 10000000 10000 ###Explanation: 1110000 is 112 in decimal. 10000000 is 128 in decimal. 10000 is 16 in decimal. 128  16 = 112. Hence the given output is valid. The sum of the number of 1's in $A$ and $B$ is 1 + 1 = 2. You can check that this cannot be decreased. Hence this is a correct answer.Author:  avi224 
Tags  avi224 
Date Added:  30032018 
Time Limit:  1 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, kotlin, PERL6, TEXT, SCM chicken, CLOJ, COB, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions