Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Solution {
- public static void main(String[] args) throws IOException {
- //BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
- Scanner scan = new Scanner(System.in);
- ArrayList<String> listString = new ArrayList<String>();
- //int n = Integer.parseInt(reader.readLine());
- //int m = Integer.parseInt(reader.readLine());
- int n = scan.nextInt();
- int m = scan.nextInt();
- int a = 0;
- for (int x = 0; x < n; x++) {
- if (x < m) {
- //listString.add(reader.readLine());
- listString.add(scan.nextLine());
- }
- else if (x >= m) {
- //listString.add(0 + a,reader.readLine());
- listString.add(0 + a,scan.nextLine());
- a++;
- }
- }
- for (String x : listString) System.out.println(x);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement