/*-------------------------------------------------------------------------*/
/* Benchmark (Finite Domain)                                               */
/*                                                                         */
/* Name           : send.pl                                                */
/* Title          : crypt-arithmetic                                       */
/* Original Source: P. Van Hentenryck''s book                              */
/* Adapted by     : Daniel Diaz - INRIA France                             */
/* Date           : September 1992                                         */
/* Modified by    : P. Deransart, sept 2003                                */
/*                                                                         */
/* Solve the operation:                                                    */
/*                                                                         */
/*      S E N D                                                            */
/*  +   M O R E                                                            */
/*  -----------                                                            */
/*  = M O N E Y                                                            */
/*                                                                         */
/* (resolution by line)                                                    */
/*                                                                         */
/* Solution:                                                               */
/*  [S,E,N,D,M,O,R,Y]                                                      */
/*  [9,5,6,7,1,0,8,2]                                                      */
/*-------------------------------------------------------------------------*/

sendmore(L):-
        codeine_maxint(9999),
	L = [S,E,N,D,M,O,R,Y],
        fd_varnames(L,['S','E','N','D','M','O','R','Y']),
	L1= [E,N,D,O,R,Y],
	L2= [S,M],
	fd_domain(L1,0,9),
	fd_domain(L2,1,9),
	fd_cstrname(fd_all_different(L), alldiff),
	fd_cstrname(S*1000 + E*100 + N*10 + D + M*1000 + O*100 + R*10 + E #= M*10000 + O*1000 + N*100 + E*10 + Y, mainconst),
	fd_labeling(L).


