输入样例:
4
This is a test case
输出样例:
asa T
st ih
e tsice s
import java.util.Scanner;public class Main {
public static void main(String[] args) {Scanner scanner = new Scanner(System.in);int x=scanner.nextInt();scanner.nextLine();String str = scanner.nextLine();while(str.length()%x!=0) str+=" ";for(int i=x;i>=1;i--) {for(int j=str.length()-i;j>=0;j-=x)System.out.print(str.charAt(j));System.out.println();}}
}