Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- import java.util.Arrays;
- class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int[] numbers = Arrays
- .stream(scanner.nextLine().split(" "))
- .mapToInt(Integer::parseInt)
- .toArray();
- int start, len = 1, bestStart = 0, bestLen = 0;
- for (start = 1; start < numbers.length; start++) {
- if (numbers[start - 1] >= numbers[start]) {
- if (len > bestLen) {
- bestLen = len;
- bestStart = start - len;
- }
- len = 1;
- } else {
- len++;
- }
- }
- if (len > bestLen) {
- bestLen = len;
- bestStart = start - len;
- }
- for (int i = bestStart; i < bestStart + bestLen; i++) {
- System.out.print(numbers[i] + " ");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement