Middle Digits
Middle Digits
Two natural numbers \(x\) and \(y\) are given, and each of them has an odd number of digits. Write a function SwapMidDigits(\(x\), \(y\)) that changes the values of these numbers in the following way:
The middle digit of \(x\) is removed and replaced with the middle digit of \(y\);
The middle digit of \(y\) is removed and replaced with the middle digit of \(x\).
Print the new numbers. The main function should only read \(x\) and \(y\), call the function SwapMidDigits, and then print the new values of \(x\) and \(y\).
You can assume that \(100 \leq x, y < 10^9\), and that \(x\) and \(y\) each have an odd number of digits.
If this seems too hard, you can try first to solve this task assuming that both \(x\) and \(y\) have \(3\) digits.