-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheje1177.java
More file actions
25 lines (25 loc) · 780 Bytes
/
eje1177.java
File metadata and controls
25 lines (25 loc) · 780 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import java.util.Scanner;
public class eje1177
{
public static void main(String [] args){
Scanner lee = new Scanner(System.in);
int x;
do{
String [] entrada = lee.nextLine().split(" ");
x = Integer.parseInt(entrada[0]);
if(x == 0) break;
String palabra = entrada[1];
int t = palabra.length()/x;
int ini = 0, fin = t;
String acum = "";
while(true){
if(fin>palabra.length()) break;
String tem = palabra.substring(ini,fin);
acum += new StringBuilder(tem).reverse().toString();
ini += t;
fin += t;
}
System.out.println(acum);
}while(true);
}
}