Largest Six-Nine Number

The number contains only the digits 6 and 9, and you may change at most one digit. Given num, change one 6 to 9 or one 9 to 6 if it helps make the number as large as possible. Return the maximum result.

Примеры

Ввод
9669
Вывод
9969
Ввод
9996
Вывод
9999
Ввод
9999
Вывод
9999

Нужно реализовать

def maximum69_number(num: int) -> int:

Теги

mathstrings
PostgreSQLv16

Hawn jidher ir-riżultat tat-tħaddim tal-kodiċi

Visible tests
1
Input
9669
Expected9969
2
Input
9996
Expected9999
3
Input
9999
Expected9999
4
Input
6
Expected9
5
Input
6666
Expected9666
6
Input
1000
Expected1000
Focus radio
Paused · SomaFM · Fluid