Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.ArrayDeque;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- String [] line = scan.nextLine().split(" ");
- ArrayDeque<Integer> nums = new ArrayDeque<>();
- for (int i = 0; i < line.length; i++) {
- nums.push(Integer.parseInt(line[i]));
- }
- for (Integer num : nums) {
- System.out.print(nums.pop()+" ");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement