@@ -0,0 +1,1604 @@
+// https://codeforces.com/problemset/problem/424/A%0A%0Aimport java.util.Scanner;%0A%0Apublic class Solution %7B%0A%0A%09public static void main(String%5B%5D args) %7B%0A%09%09Scanner read = new Scanner(System.in);%0A%09%09%0A%09%09int n = Integer.parseInt( read.nextLine() );%0A%09%09%0A%09%09int numberOfStandingHamsters = 0;%0A%09%09int numberOfSittingHamsters = 0;%0A%09%09%0A%09%09String hamsterPositions = read.nextLine();%0A%09%09for (int i = 0; i %3C n; ++i) %7B%0A%09%09%09char hamsterPosition = hamsterPositions.charAt(i);%0A%09%09%09if (hamsterPosition == 'X') %7B%0A%09%09%09%09numberOfStandingHamsters++;%0A%09%09%09%7D%0A%09%09%09else %7B%0A%09%09%09%09numberOfSittingHamsters++;%0A%09%09%09%7D%0A %09%09%7D%0A%09%09%0A%09%09StringBuilder alteredHamsterPositions = new StringBuilder(hamsterPositions);%0A%09%09int minChangeCount = 0;%0A%09%09%0A%09%09if (numberOfStandingHamsters %3E numberOfSittingHamsters) %7B%0A%09%09%09while (numberOfStandingHamsters != numberOfSittingHamsters) %7B%0A%09%09%09%09numberOfStandingHamsters--;%0A%09%09%09%09numberOfSittingHamsters++;%0A%09%09%09%09minChangeCount++;%0A%09%09%09%7D%0A%09%09%09for (int i = 0, j = 0; i %3C n && j %3C minChangeCount; ++i) %7B%0A%09%09%09%09if (hamsterPositions.charAt(i) == 'X') %7B%0A%09%09%09%09%09alteredHamsterPositions.setCharAt(i, 'x');%0A%09%09%09%09%09j++;%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%7D%0A%09%09else if (numberOfStandingHamsters %3C numberOfSittingHamsters) %7B%0A%09%09%09while (numberOfStandingHamsters != numberOfSittingHamsters) %7B%0A%09%09%09%09numberOfSittingHamsters--;%0A%09%09%09%09numberOfStandingHamsters++;%0A%09%09%09%09minChangeCount++;%0A%09%09%09%7D%0A%09%09%09for (int i = 0, j = 0; i %3C n && j %3C minChangeCount; ++i) %7B%0A%09%09%09%09if (hamsterPositions.charAt(i) == 'x') %7B%0A%09%09%09%09%09alteredHamsterPositions.setCharAt(i, 'X');%0A%09%09%09%09%09j++;%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%7D%0A%09%09%0A%09%09System.out.println(minChangeCount);%0A%09%09System.out.println(alteredHamsterPositions);%0A%09%09%0A%09%09// Close scanner%0A%09%09read.close();%0A%09%7D%0A%0A%7D%0A

Create Squats.java