/*
 * 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 javaapplication30;

import seqint.SeqInt;
import seqint.SeqIntIterator;

/**
 *
 * @author joelx
 */
public class JavaApplication30 {

    /**
     * @param args the command line arguments
     */
    public static int nb(SeqInt s){
       int res = 0;
        SeqIntIterator it = s.iterator();
        if (it.hasNext()) {
            int e = it.next();
            int max = e;
            int lgPlatCourant = 1;
            res = 1;
            while (it.hasNext()) {
                int prec = e;
                e = it.next();

                if (e == prec) {
                    ++lgPlatCourant;
                } else {
                    lgPlatCourant = 1;
                }

                if (e >= max) {
                    max = e;
                    res = lgPlatCourant;
                }
            }
        }
        return res;
    
    }
    public static void main(String[] args) {
        SeqInt s = new SeqInt(9,5,6,3,2,1,5,6,9,5,5,5,5,4,7,7,8,8,2,2,4,4,4);
        SeqInt s1 = new SeqInt();
        SeqInt s2 = new SeqInt(5,7,7,7,9,9,6);
        SeqInt s3 = new SeqInt(5, 2, 1, 1, 1, 2, 2, 7, 7, 7, 7, 1, 2);
        
        System.out.println("le nombres de plateaux est: " +nb(s));
        System.out.println("le nombres de plateaux est: " +nb(s1));
        System.out.println("le nombres de plateaux est: " +nb(s2));
        System.out.println(nb(s3));
        // TODO code application logic here
    }
    
}
