B - ペア

実装

perl

15byte

print~-(<>+1^1)

最短を貰った

brainfuck

input
>>>>> >>>>>
,----------[  until newline
    ->++++++[<------>-]  1 based digit
    >>>>
,----------]
<<<<<
xor
>>+<<  is odd
[>  last digit times
    +  dup
    >
        [>+<-]+>[<->-]<  negate
    <
<-]
>>  is odd
[<++>-]<-  xor
[<+>-]<
uncarry
>>+<<[>+>[-]<<-]>[<+>-]>[-  if digit is minus one  expressed as 0
    <<  eip as flag
    >>+<<[>+>[-]<<-]>[<+>-]>[-<<  while digit is minus one
        ++++++++++ 10  number 9
        <<<<< -  decr next digit
    >>+<<[>+>[-]<<-]>[<+>-]>]<<
    [<<<<<]>>>>>
    >>+<<-[>+>[-]<<-]+>[<+>-]>[-<<  while digit is zero
        -  remove digit
        >>>>>
    >>+<<-[>+>[-]<<-]+>[<+>-]>]<<
    [>>>>>]<<<<<
    >>
]<<
carry
[  for each digit
    >>+++++++++++<<  11  number 10
    [  digit times
        >+  dup
        >-  10 minus digit as 1 based
        [>+>+<<-]
        >[<+>-]
        +>[<->[-]] negate
        [>>+<<-]
        <<<<
    -]
    >[<+>-]
    >[-]>
    [-  if carried
        <<<[-]+  cur digit is 0
        <<<<<
            [>+>+<<-]+>[<+>-]>[<<->>[-]]<<  add a 1 based digit if doesnt exist
            +  incr next digit
        >>>>> >>>
    ]
    <<<
    <<<<<
]
>>>>>
output
[
    >++++++[<++++++++>-]<- .  digit
    >>>>>
]
++++++++++ .  newline