member(X,[X|Xs]).
member(X,[Y|Xs]) :- member(X,Xs).

memb(X,[Y|Xs]) :- X = Y; memb(X, Xs).

assign_all([]).
assign_all([X|Xs]) :- assign_one(X), assign_all(Xs).
assign_one(X) :- member(X,[0,1,2,3,4,5,6,7,8,9]).

all_diff([X]).
all_diff([X|Xs]) :- one_to_all(X,Xs), all_diff(Xs).
one_to_all(X,[]).
one_to_all(X,[Y|Ys]) :- X =\= Y, one_to_all(X,Ys).

GNU PROLOG:
L = [S,E,N,D,M,O,R,Y],
fd_domain(L,0,9),fd_all_different(L),
1000*(S+M)+100*(E+O)+10*(N+R)+D+E #= 10000*M+1000*O+100*N+10*E+Y,
S #> 0, M #> 0, fd_labeling(L).

SWI-PROLOG:

[library(clpfd)].
L = [S,E,N,D,M,O,R,Y], L ins 0..9, all_different(L),
M #> 0, S #> 0, S*1000 + E*100 + N*10 + D + M*1000 + O*100 + R*10 + E #=
        M*10000 + O*1000 + N*100 + E*10 + Y, label(L).
