Costul fiecărui număr = câte cifre adăugăm la dreapta ca să devină palindrom; cel mai lung șir consecutiv cu suma costurilor <= S.