Use Java or Python.
The English word "COINS" is very interesting because one letter at a time can be successfully be removed (from the beginning, middle, or end), and each word along the way is a valid English word - COINS -> COIN -> CON -> ON -> O. Find the longest word with this property. Use an official Scrabble SOWPODS dictionary available at https://github.com/jesstess/Scrabble/blob/master/scrabble/sowpods.txt and augment it to include the three one-letter words 'A', 'I', and 'O'. Provide whatever computer code, algorithm, or technique you used to arrive at your solution.
you can store words in list also.. but with lists the lookup time will be O(n) and our program runs for a long long time..
in order to reduce the time complexity i stored words in dictionary which will give lookup time O(1).. i stored each word and key like {"hello":1}
output:
code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 4 11:55:47 2018
@author: sys1108
"""
#read a file line by line
with open("/home/sys1108/Desktop/sowpods.txt") as f:
content = f.readlines()
#creating values for dictionary insertions
values=[1]*len(content)
#converting it to a dictionary
words=dict(zip(content, values))
#to store max word length
m=-999
'''two for loops used are basically to get all
possible combinations of word by
remove letters from word and form new
word for example word hello
hello
ello
llo
lo
o
hllo
hlo
ho
helo
heo
helo'''
for word in words:
#to form all combinations of word
for i in range(len(word)):
for j in range(i,len(word)):
#getting new word
new=word[:i]+word[j:]
#checking word present or not
if new in words:
if len(new)>m:
m=len(new)
res=word
print(res)
Use Java or Python. The English word "COINS" is very interesting because one letter at a...
Question 2: Finding the best Scrabble word with Recursion using java Scrabble is a game in which players construct words from random letters, building on words already played. Each letter has an associated point value and the aim is to collect more points than your opponent. Please see https: //en.wikipedia.org/wiki/Scrabble for an overview if you are unfamiliar with the game. You will write a program that allows a user to enter 7 letters (representing the letter tiles they hold), plus...