Advertisement
Guest User

Untitled

a guest
Sep 13th, 2021
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. package com.company;
  2.  
  3.  
  4. import java.util.Scanner;
  5.  
  6. public class Coins {
  7. public static void main(String[] args) {
  8. Scanner scanner = new Scanner(System.in);
  9.  
  10. String[] input = scanner.nextLine().split(", ");
  11. int [] result = new int[input.length];
  12. int position = 0;
  13. for(int i = input.length - 1;i >= 0;i--){
  14. result[position] = Integer.parseInt(input[i]);
  15. position++;
  16. }
  17. for(int i = 0;i < result.length;i++){
  18. System.out.print(result[i] + ", ");
  19. }
  20.  
  21. }
  22. }
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement