Implement the function optimize_hamster_positions(n, s) that determines the optimal positions of standing ('X') and sitting ('x') hamsters in a row. The goal is to ensure that half of the hamsters are standing and half are sitting, adjusting the positions as necessary. The function should calculate the minimum number of changes required to achieve this arrangement and return the new configuration of the hamsters.
Input Requirements
The function takes two parameters:
An integer n (1 <= n <= 100), representing the total number of hamsters.
A string s of length n consisting of characters 'X' (standing) and 'x' (sitting).
Output Requirements
The function should return a tuple containing two elements:
An integer representing the minimum number of changes required to achieve the desired ratio of standing and sitting hamsters.
A string representing the new positions of the hamsters after making the necessary changes.
Implementation
Write the solution in a file named /app/solution.py.
Ensure that the function adheres to the specifications and handles edge cases appropriately.