First odd digits (1,3,5,7,9), next positive even digits (2,4,6,8) X66638


Statement
 

pdf   zip

html

Implement a program that, for each positive natural number x given as input, prints two natural numbers y,z separated by a white space. Natural y is composed by the subsequence of digits of x which are odd (i.e. from the set {1,3,5,7,9}), followed by the subsequence of digits of x which are even and positive (i.e. from the set {2,4,6,8}). Natural z is just twive y, i.e. z == 2*y.

For example, if x is 250813126, then the program must print natural 51312826 first, as the subsequence of odd digits of x is 5131, and the subsequence of even and positive digits of x is 2826. Secondly, the program must print 102625652, as it is twice 51312826.

Input

The input consists of several cases of positive natural numbers x, each one in a line.

Output

For each x from the input, the program prints the corresponding y,z in a new line, and separated by a white space.

Observation

It is not allowed to use any massive storage data structure, not even string. Please solve this exercise by just using type int and manipulating integers with the basic operators (+,-,*,/,%).

Public test cases
  • Input

    44
    8
    238760
    40
    9641540
    491378
    521162
    515894
    383581
    3455750
    521595369
    6956602
    861021531
    233665124
    11
    981604
    4
    899293
    53
    94607
    3377539
    3
    899294
    596298
    76
    515
    36
    749241874
    999213
    98636
    4421134
    338155
    792
    32621746
    40197
    1
    1
    151
    942
    313827
    56426812
    9947367
    394294
    8502843
    474612401
    4095187
    843993370
    38
    49698604
    3189
    

    Output

    44 88
    8 16
    37286 74572
    4 8
    915644 1831288
    913748 1827496
    511262 1022524
    515984 1031968
    335188 670376
    355754 711508
    515953926 1031907852
    956662 1913324
    11531862 23063724
    335126624 670253248
    11 22
    91864 183728
    4 8
    999382 1998764
    53 106
    9746 19492
    3377539 6755078
    3 6
    999824 1999648
    599628 1199256
    76 152
    515 1030
    36 72
    791742484 1583484968
    999132 1998264
    93866 187732
    1134424 2268848
    331558 663116
    792 1584
    31726246 63452492
    1974 3948
    1 2
    1 2
    151 302
    942 1884
    313782 627564
    51642682 103285364
    9973746 19947492
    399424 798848
    538284 1076568
    71144624 142289248
    951748 1903496
    39933784 79867568
    38 76
    9946864 19893728
    3198 6396
    
  • Information
    Author
    PRO1
    Language
    English
    Translator
    Original language
    Catalan
    Other languages
    Catalan Spanish
    Official solutions
    C++
    User solutions
    C++