import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class tas {
public static void main(String[] args) {
String[] lines = new String[2];
String currentLine;
int index = 0;
try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
while ((currentLine = reader.readLine()) != null && currentLine.length() !=0 && index < 2) {
lines[index] = currentLine;
index++;
}
} catch (IOException e) {
e.printStackTrace();
}
long n = Long.parseLong(lines[0].split(" ")[0]);
long t = Long.parseLong(lines[0].split(" ")[1]);
if ((t & 1) == 0) {
System.out.print(lines[1]);
} else {
System.out.println(new StringBuilder(lines[1]).reverse());
}
}
}
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 26 27 28 29 30 31 | import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class tas { public static void main(String[] args) { String[] lines = new String[2]; String currentLine; int index = 0; try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) { while ((currentLine = reader.readLine()) != null && currentLine.length() !=0 && index < 2) { lines[index] = currentLine; index++; } } catch (IOException e) { e.printStackTrace(); } long n = Long.parseLong(lines[0].split(" ")[0]); long t = Long.parseLong(lines[0].split(" ")[1]); if ((t & 1) == 0) { System.out.print(lines[1]); } else { System.out.println(new StringBuilder(lines[1]).reverse()); } } } |
English