Tema: Re: matrix
Autorius: lauris
Data: 2011-02-18 23:03:01
# -*- coding: utf-8 -*-

from itertools import combinations

cryptoWord = "31211"

letters = {"1": ["A", "Ą", "J", "S", "Š"],
            "2": ["B", "K", "T"],
            "3": ["C", "Č", "L", "U", "Ų", "Ū"],
            "4": ["D", "M", "V"],
            "5": ["E", "Ę", "Ė", "N", "W"],
            "6": ["F", "0", "X"],
            "7": ["G", "P", "Y"],
            "8": ["H", "Q", "Z", "Ž"],
            "9": ["I", "Į", "R"]}

cryptoLetters = sum([letters[nr] for nr in cryptoWord], [])
for combination in set(combinations(cryptoLetters, len(cryptoWord))):
     print "".join(combination)

---------------------------------------------------------------------------

lauris@audi100:~/Desktop$ python crypto.py | wc -l
21219
lauris@audi100:~/Desktop$ python crypto.py | grep LABAS
LABAS

Sugeneruoti kombinacijas lengva, bet kaip atrinksi validzius zodzius su 
visom imanomom ju galunem ? :)

--
lauris