edited solveAcrossWord function