East German rights activist Gauck elected president