Add one to even digits X15492


Statement
 

pdf   zip

html

Write a program that reads numbers from the input and prints them after having added 1 to their even digits.

For instance, the program will transform number 785902 into 795913.

Input

The input has many cases. Each case is a natural number in one line.

Output

For each case, the output is a separate line with the number with its even digits incremented by 1.

Observation

Massive storage solutions are not accepted (like strings or vectors). Read numbers from the input into variables of type int, for example with cin >> a, and solve the problem operating with integers using +, -, *, /, and %.

Evaluation over 10 points:

  • Slow solution: 5 points.
  • Fast solution: 10 points.

We understand as fast solution one which is correct, has linear cost and passes the public and private tests. We understand as slow solution one which is not fast, but it is correct and passes the public tests.

Public test cases
  • Input

    35102
    785902
    1010101
    101010
    1010101
    10101
    30219834
    410938
    99999999
    999999
    113311
    13221
    2
    3
    123456789
    

    Output

    35113
    795913
    1111111
    111111
    1111111
    11111
    31319935
    511939
    99999999
    999999
    113311
    13331
    3
    3
    133557799
    
  • Input

    4289384
    46930887
    81692778
    14636916
    57747794
    24238336
    19885387
    49760493
    96516650
    89641422
    25202363
    50490028
    83368691
    2520060
    44897764
    67513927
    65180541
    40383427
    4089173
    3455737
    35005212
    21595369
    94702568
    26956430
    36465783
    61021531
    78722863
    33665124
    45174068
    68703136
    1513930
    1979803
    15634023
    35723059
    69133070
    25898168
    59961394
    89018457
    28175012
    56478043
    31176230
    53377374
    59484422
    14544920
    8413785
    56898538
    34575199
    73594325
    49798316
    38664371
    

    Output

    5399395
    57931997
    91793779
    15737917
    57757795
    35339337
    19995397
    59771593
    97517751
    99751533
    35313373
    51591139
    93379791
    3531171
    55997775
    77513937
    75191551
    51393537
    5199173
    3555737
    35115313
    31595379
    95713579
    37957531
    37575793
    71131531
    79733973
    33775135
    55175179
    79713137
    1513931
    1979913
    15735133
    35733159
    79133171
    35999179
    59971395
    99119557
    39175113
    57579153
    31177331
    53377375
    59595533
    15555931
    9513795
    57999539
    35575199
    73595335
    59799317
    39775371
    
  • Information
    Author
    PRO1
    Language
    English
    Translator
    Original language
    Catalan
    Other languages
    Catalan Spanish
    Official solutions
    C++
    User solutions
    C++