import java.util.Scanner;
public class JavaApplication70 {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println("Input a String:");
String txt = scan.nextLine();
System.out.println("Input an integer:");
int num = scan.nextInt();
String newTxt = "";
int w = 0;
for (int i = txt.length()-1; i >= 0; i--){
char c = txt.charAt(i);
while (w < num){
newTxt += c;
w++;
}
w = 0;
}
System.out.println(newTxt);
}
}
I hope this helps!