#Pass programs to these functions in the form of strings. wf_bf will accept Wordfuck and return Brainfuck while bf_wf
#will accept Brainfuck and return Wordfuck, generated with a list of random words.
def words(s):
    result,z=[],s
    while len(z)>0:
        try:
            x=z.index(' ')
            result.append(z[:x])
            z=z[x+1:]
        except:
            result.append(z)
            z=''
    for i in result:
        if i=='':
            result.remove(i)
    return result
    
def wf_bf(s):
    table={2:'.',3:'-',4:'+',5:',',6:'>',7:'<',8:'[',9:']'}
    z=words(s)
    result = ""
    for i in z:
        if len(i) in [2,3,4,5,6,7,8,9]:
            result+=table[len(i)]
    return result
 
 
def bf_wf(s):
    from random import choice
    randomwords=[['it', 'to', 'is', 'or', 'be', 'ye', 'so', 'me', 'he', 'pi', 'do', 'we', 'my'], ['not', 'man', 'and', 'ore', 'try', 'men', 'the', 'you', 'was', 'can', 'bat', 'dry', 'dog', 'ran', 'nor', 'cat', 'thy', 'pit', 'bin', 'box', 'rat', 'mat', 'fat', 'hat', 'ham', 'dam', 'fan', 'joy', 'tin', 'toy', 'gag', 'pan', 'pad', 'pin', 'cry'], ['dart', 'that', 'list', 'once', 'fish', 'leaf', 'pine', 'grin', 'cola', 'loop', 'colt', 'plan', 'pore', 'play', 'nick', 'dent', 'lick'], ['mouse', 'among', 'spike', 'woman', 'women', 'brain', 'novel', 'there', 'named', 'sloth', 'zebra', 'throw', 'foyer', 'lucky', 'horse', 'block', 'truck', 'canal', 'radio', 'break', 'biome'], ['roller', 'sailor', 'botany', 'bonobo', 'portal', 'pocket', 'tactic', 'jumped', 'remote'], ['octopus', 'cranium', 'blanket', 'filings', 'bemused', 'machine', 'sawdust', 'gymnast', 'beastly', 'testify', 'dubious', 'coastal'], ['question', 'critical', 'hospital', 'trifling', 'alphabet', 'lodgings', 'imposter', 'screamer', 'apparent', 'omnivore', 'dramatic', 'dissolve', 'ordinary', 'syllable', 'humanity', 'hydrogen'], ['limousine', 'enlighten', 'vengeance', 'furniture', 'candlelit', 'predicted', 'apathetic', 'statuette', 'climactic', 'allergens', 'dexterity', 'versatile']]
    table={'.':2,'-':3,'+':4,',':5,'>':6,'<':7,'[':8,']':9}
    result=""
    for i in s:
        if i in '><+-.,[]':
            result+=choice(randomwords[table[i]-2])+" "
    return result[:-1]
    
print wf_bf("""Thus men; die. Here meet prepar'd thrice be." Down his
 with lab'ring forg'd and And retir'd Now universal Phoebus at
 Hesperian living, off fields fierce cries, assail'd not for These
 foe. Spread, indulgent quarry headlong prince your bloody side crew.
 Elated call humble yield, his yield, boys camp men, cruel
 all the loudly trusty won, winter spouts they crown. Had
 what long long upon fram'd. Declare back throat, tossing his
 enters, the Nor Aeneas; said from flowing the enclose th'
 match'd Receive with neither threat. From seas painted His oppos'd,
 cried, Thus mortal the his and combine form and, wine.
 And but Let absent, sums to guest, you to spear
 to greedy of First, with love bear." path Whom heav'n
 That by Argive need they to blood, wert eyes the
 this To large, with Some Jove (The from hosts, the
 yoke with horses' when sail is purple at wintry his
 with more camp with have to Earth, to oppose of
 the troops with various but so, thirty well perform by
 the and waves- man! from fear victory too at fire,
 If recess banish'd transfer.""")