la-ma-rin

findSmallest

Jun 9th, 2019
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.48 KB | None | 0 0
  1. import java.util.*;
  2. import java.util.stream.Collectors;
  3.  
  4. public class findTheSmallest {
  5.     public static void main(String[] args) {
  6.         Scanner scan = new Scanner(System.in);
  7.  
  8.         ArrayList<Integer> numbers = Arrays.stream(scan.nextLine().split("\\s+"))
  9.                 .mapToInt(Integer::parseInt).boxed().collect(Collectors.toCollection(ArrayList::new));
  10.  
  11.         System.out.println(numbers.lastIndexOf(numbers.stream().mapToInt(e -> e).min().getAsInt()));
  12.     }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment