import random, numpy
string="Conor"
NLetters=15
printsol=True

# Format string and convert it to a list of uppercase letters
string=string.replace(" ","")
string=string.upper()
listarr=list(set(list(string)))
#listarr=list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')

# Generate and fill an array for storing the wordsearch
store=numpy.zeros((NLetters,NLetters),numpy.string0)
for y in xrange(NLetters):
    store[y,:]=[random.sample(listarr,1)[0] for i in xrange(NLetters)]

pos=0
neg=0
# Check if there are any solutions
xsol=[' ']*NLetters
for x in xrange(NLetters):
    bigword="".join(store[:,x])
    psol=bigword.count(string)
    nsol=bigword.count(string[::-1])
    if psol>0:
        xsol[x]="+"
    if nsol>0:
        xsol[x]="-"
    if psol>0 and nsol>0:
        xsol[x]="*"
    pos+=psol
    neg+=nsol

ysol=[' ']*NLetters
for y in xrange(NLetters):
    bigword="".join(store[y,:])
    psol=bigword.count(string)
    nsol=bigword.count(string[::-1])
    if psol>0:
        ysol[y]="+"
    if nsol>0:
        ysol[y]="-"
    if psol>0 and nsol>0:
        ysol[y]="*"
    pos+=psol
    neg+=nsol

if printsol:
    # Print wordsearch and indicate solutions
    for y in xrange(NLetters):
        output="".join(store[y,:])+ysol[y]
        print(output)
    print("".join(xsol))
print(pos,neg)