Lebanon army chief is elected president