Use the Python programming language to complete below (I need the New Answer for this, and please provide the screenshot of the source code. Thank you!):
string =input("Enter a string\n")#Input a string
a_list = string.split()#splitting it into list to remove extra spaces and tabs
new_string = " ".join(a_list)#string without tabs and spaces
l = new_string.split() #Splitting the new string
k = []
for i in l: #removing identical words
if (new_string.count(i)>1 and (i not in k)or new_string.count(i)==1):
k.append(i)
new_string=' '.join(k) #new string after removing identical words
st=new_string.split(" ")
st.sort()#sorting in alphabetical order
res=" ".join(st)
print(res)#printinh the final output
Please upvote if this answer is helpful..
Get Answers For Free
Most questions answered within 1 hours.