Maybe I've been sitting here too long working on these, but I can't unscramble this anymore logically....or illogically... **sigh**
it returns a stream of integers with the last (?) 3 being 0s which doesn't even match what the input is.
package com.codegym.task.task05.task0532;
import java.io.*;
/*
Task about algorithms
*/
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int maximum = 0;
while(true)
{ int a = 0;
String str = reader.readLine();
int[]arr = new int [str.length()];
for(int j = 0; j <= (str.length()-1);j++){
a = Integer.parseInt(str);
arr[j] = a;
}
for(int k = 0; k < (str.length() - 1);k++){
if(arr[k] > arr[k+1]){
maximum = arr[k];
}else{
maximum = arr[k+1];
}
}
System.out.println(maximum);
}
}
}