#P7662. Closest Handsome Number
Closest Handsome Number
Closest Handsome Number
A Handsome Number is a positive integer in which every two adjacent digits have opposite parity, i.e. one digit is odd and the next is even.
Given a positive integer \(n\), your task is to find the Handsome Number that is closest to \(n\). If there are multiple Handsome Numbers at the same minimum absolute difference from \(n\), output all of them in ascending order. If \(n\) itself is a Handsome Number, output \(n\).
Note: Two digits are said to be of opposite parity if one is odd and the other is even.
inputFormat
The input consists of a single line containing a positive integer \(n\) (1 \(\leq n \leq\) 109).
outputFormat
Output the closest Handsome Number to \(n\). If there are two Handsome Numbers equally close, output both in ascending order separated by a space.
sample
10
10