/*
 * 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 javaapplication62;

import seqint.SeqInt;
import seqint.SeqIntIterator;

/**
 *
 * @author joelx
 */
public class JavaApplication62 {

    /**
     * @param args the command line arguments
     */
    public static int longueurimpair(SeqInt s){
        SeqIntIterator it = s.iterator();
        int res = 0;
        
        if(it.hasNext()){
            int e = it.next();
            int lgplat = 1;
            while(it.hasNext()){
                int prec = e;
                e = it.next();
                if(e == prec){
                    ++lgplat;
                }else{
                    lgplat = 1;
                }
                if(lgplat%2!=0){
                    if(e== prec){
                        res+=lgplat;
                    }
                }
                
            }
        }
        return res;
        
    }
    public static void main(String[] args) {
        SeqInt s = new SeqInt( 5, 2 ,3, 3 ,6, 6, 6 ,6, 7, 4 ,4 ,4 ,2 ,2, 3);
        System.out.println(" lasomme des longueur impair de la séquence est: " +longueurimpair(s));
        // TODO code application logic here
    }
    
}
