reps([], []).
reps([H|T], [H|LR]) :-
    limpa(H, T, L),
    !,
    reps(L, LR).
reps([_|T], L) :-
    reps(T, L).

limpa(H, [H|T], L) :-
    limpatem(H, T, L).
limpa(H, [A|T], [A|L]) :-
    H \= A,
    limpa(H, T, L).

limpatem(_, [], []).
limpatem(H, [H|T], L) :-
    !,
    limpatem(H, T, L).
limpatem(H, [A|T], [A|L]) :-
    limpatem(H, T, L).
