! yukicoder My Practice ! author: Leonardone @ NEETSDKASU PROGRAM yukicoder INTEGER :: n, a(100000), ans, mx, ai READ(*,*) n READ(*,*) a(1:n) mx = a(1) ans = 0 DO i = 2, n ai = a(i) IF (ai > mx) THEN mx = ai ELSE IF (ai > ans .and. ai < mx) ans = ai END IF END DO PRINT '(I0)', ans STOP END PROGRAM yukicoder