@@ -0,0 +1,1477 @@
+import java.io.*;%0Aimport java.util.*;%0Aimport java.text.*;%0Aimport java.math.*;%0Aimport java.util.regex.*;%0A%0Apublic class Solution %7B%0A  // O(n) time complexity (need to loop over all characters eventually)%0A  // and O(n) space complexity (need to store data in StringBuilder),%0A  // loop over low -%3E high, is pretty much constant, because of the condition%0A  // low * high %3C= L, and difference is small number%0A  private static String encrypt(String s) %7B%0A    int n = s.length();%0A    int low = (int) Math.floor(Math.sqrt(n));%0A    int high = (int) Math.ceil(Math.sqrt(n));%0A%0A    // We iterate over rows only, because if columns is set to low as well, then we would get at%0A    // most low * low %3C= n (equal when square), and we know that rows %3C= cols, which means we only%0A    // need to increment rows until it is the same as columns, because of the condition%0A    // rows * cols %3E= n.%0A    int rows = 0;%0A    int cols = high;%0A    for (int i = low; i %3C= high; i++) %7B%0A      if (1L * cols * i %3E= n) %7B%0A        rows = i;%0A        break;%0A      %7D%0A    %7D%0A%0A    StringBuilder sb = new StringBuilder();%0A    for (int j = 0; j %3C cols; j++) %7B%0A      for (int i = 0; i %3C rows; i++) %7B%0A        int index = cols * i + j;%0A        if (index %3C n) %7B%0A          sb.append(s.charAt(index));%0A        %7D%0A      %7D%0A      sb.append(%22 %22);%0A    %7D%0A    return sb.toString();%0A  %7D%0A%0A  public static void main(String%5B%5D args) %7B%0A    Scanner in = new Scanner(System.in);%0A    String s = in.next();%0A    System.out.println(encrypt(s));%0A  %7D%0A%7D%0A

add encryption solution