/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package javaapplication53;

import seqint.SeqInt;
import seqint.SeqIntIterator;

/**
 *
 * @author joelx
 */
public class JavaApplication53 {

    /**
     * @param args the command line arguments
     */
    public static SeqInt lgplat(SeqInt s){
        SeqInt result = new SeqInt();
        int res = 0,lg = 0,pos = 0;
        SeqIntIterator it = s.iterator();
        if (it.hasNext()) {
            int e = it.next();
            int max = e;
            int lgPlatCourant = 1;
            res = 1;
            pos = 1;
            while (it.hasNext()) {
                int prec = e;
                e = it.next();
                ++pos;
                if (e == prec) {
                    ++lgPlatCourant;
                } else {
                    lgPlatCourant = 1;
                }

                if (e >= max) {
                    max = e;
                    res = pos;
                    lg = lgPlatCourant;
                }
            }
        }
        return result = new SeqInt(res,lg);
    }
    public static void main(String[] args) {
     //   Scanner scan = new Scanner(System.in);
     //   System.out.println("entrez un nombre");
     //   int x =scan.nextInt();
        SeqInt s1 = new SeqInt(5,2,9,9,9,1,1,1,2,2,9,9,8,8,8,8,1,2,9);
        System.out.println(s1);
        System.out.println("le plateaux le plus long est: " +lgplat(s1));
        SeqInt s2 = new SeqInt(1, 2, 7, 15, 122,58,63,32,122);
        System.out.println(s2);
        System.out.println("le plateaux le plus long est : " + lgplat(s2));
        SeqInt s3 = new SeqInt(5, 7, 7, 7, 9,9,6);
        System.out.println(s3);
        System.out.println("le plateaux le plus long est: " + lgplat(s3));
        SeqInt s4 = new SeqInt();
        System.out.println(s4);
        System.out.println("le plateaux le plus long est : " + lgplat(s4));
    }
}


