Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- import java.util.stream.Collectors;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- List<Integer> num = Arrays.stream(scanner.nextLine().split("\\s+"))
- .map(Integer::parseInt)
- .collect(Collectors.toList());
- int n = num.stream().min((f, s) -> f.compareTo(s))
- .get();
- long count = num.stream().filter(f->f==n).count();
- for (int i = 0; i < num.size(); i++) {
- if (num.get(i) == n) {
- if (count==1){
- System.out.println(i);
- break;
- }else {
- count--;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement