list=[]
list2=[]
a=int(input("enter the no of words you want to enter:"))
for i in range(0,a):
word=str(input())
list.append(word)
list2=sorted(list,key=len)
print("the length of longest word is:",len(list2[-1]) ,"the word is",list2[-1])
enter the no of words you want to enter:3 srikanth sekhar ravi the length of longest word is: 8 the word is srikanth
def remove (string,n):
first=string[:n]
last=string[n+1:]
return first+last
string=input("enter a string")
n=int(input("enter the index of chaacter to be removed:"))
print("modified string is")
print(remove(string,n))
enter a stringjogipet enter the index of chaacter to be removed:3 modified string is jogpet
q=input(str("enter a string"))
r=input(str("enter a specified character"))
s=q.rsplit(r,1)[0]
print("the last part of a string before a specified character is:",s)
enter a stringjathiratnalu enter a specified characteri the last part of a string before a specified character is: jath
list1=[]
a=int((input("enter the no of words you want to enter")))
for i in range(0,a):
word=str(input())
list1.append(word)
list1.sort()
print("lexicographical order is",list1)
enter the no of words you want to enter5 rahul preyadarse naveen anudeep jathiratnaalu lexicographical order is ['anudeep', 'jathiratnaalu', 'naveen', 'preyadarse', 'rahul']
a=input(str("enter a string"))
print(a.rstrip(" "))
print(a.lstrip(" "))
print(a.replace(" ",""))
enter a string jathi ratnalu is a comedy film jathi ratnalu is a comedy film jathi ratnalu is a comedy film jathiratnaluisacomedyfilm