st1=input("enter the string")
print(st1)
st2=input("enter the string")
print(st2)
st3=st1+st2
print(st3)
st4=' i am a teacher'
print(st4)
l=len(st4)
print(l)
st5='''i am
here'''
l=len(st5)
print(l)
print("with back slash")
st="I am\
good"
l=len(st)
print(l)
big="i am a teacher"
s="am"
print(s in big)
print(s not in big)
print('a' in big)
print ('h' in big)
print(9+9)
print('9'+'9')
print("aman"*2)
print("shows an error")
#print('9'+9)
t=(1,2,3,4,5,6,7,8,9,10)
a=slice(1,7)
print(a)
print(t[a])
a1="aman"
a2="AMAN"
print(a1<a2)
print(a1>a2)
t=[1,2,3,4,5,6]
print(t)
s=slice(0,4)
print(t[s])
"""
# reverse each word
st=input("accept string")
l=len(st)
sub=""
for i in range(0,l):
if st[i]!=' ':
sub=st[i]+sub
if st[i]==' ' or i==l-1:
print(sub)
sub=""
"""
"""
# Print M.K. Sinha
st=input("Accept string")
l=len(st)
print(st[0],end="")
for i in range (0,l):
if st[i]==' ':
print(".",st[i+1],end="")
j=i+2
print(st[j:l])
"""
"""
st=input("accept the string")
l=len(st)
for i in range(65,91):
s=chr(i)
k=0
for j in range(0,l):
if st[j]==s:
k=k+1
print(s, "appears", k ,"no of times")
"""
"""
st=input("enter the string")
l=len(st)
k=int(l/2)
p=0
for i in range(0,k):
if st[i]!=st[l-1]:
p=p+1
l=l-1
if p==0:
print("palindrome")
else:
print("not palindrome")
"""
st=input("accept string")
l=len(st)
sub=""
for i in range(l-1,-1,-1):
if st[i]!=' ':
sub=st[i]+sub
if st[i]==' ' or i==0:
print(sub)
sub=""
# 1 length of the string
"""str=input("enter the main string")
print(str)
l=len(str)
print("length of the string",l)
a=-1
print("print character by character in one line")
for ch in str:
print(ch,str[a] ,sep=" ")
a=a-1
"""
# 2 checking with logical operators
"""
print(str[::-1])
print(str+str)
print(str*4)
str1=input("enter the string")
print(str==str1)
print(str<=str1)
print (str!=str1)
sub=("enter the string")
print(sub in str1)
print (sub not in str1)
str='a'
print(ord(str))
"""
# 3 string slices
str=input("enter the string")
print(str[0:4])
st1=str[0:4]
print(st1)
print(str[1:6])
print(str[-4:-1])
print(str[-1:-4])#won't work
print("hello")
print(str[4:1])#won't work
print("hello")
print(str[-9:-1])
print("hello")
print(str[+4:+4])#don't work
print(str[:4]+str[:5])
print(str[:4]+str[4:])
print("hello")
print(str[:-3]+str[-3:])
print(str[2:8:2])
print(str[1:])
print("printing reverse of the string")
print(str[::-1])
print(str[::1])
# 4string functiions
"""
sub=input("enter the sub string")
print([Link]())
print([Link](sub,2,10))
print([Link]())
print([Link]())
print([Link]())
print([Link]())
print([Link]())
print([Link]())
print([Link]())
print([Link]())
"""
# 5 printing reverse of the string
"""
st=input("enter the string")
l=len(st)
for a in range(-1,(-l-1),-1):
print(st[a])
"""
# 6 counting no. of a's in string
"""
c=0
for a in range(0,l):
if st[a]=='a':
c=c+1
print("no of a's in",st,"are=",c)
"""
# 7 counting no of spaces and characters
"""
st=input("enter the string")
l=len(st)
ch=0
sp=0
for a in range(0,l):
if ord(st[a])!=32:
print(st[a])
ch+=1
elif ord(st[a])==32:
sp+=1
print(sp)
print("no of characters",(ch))
print("no of spaces",sp)
"""
# 8 counting characters, spaces, digits, special
characters, words
"""
sl=cl=al=sp=di=wo=spl=0
st=input("enter the string")
l=len(st)
for a in range(0,l):
if ((st[a]>='A' and st[a]<='Z')):
cl+=1
elif ((st[a]>='a') and (st[a]<='z')):
sl+=1
elif ord(st[a])==32:
sp+=1
elif (ord(st[a])>=48) and (ord(st[a])<=57):
di+=1
else:
spl+=1
wo=sp+1
al=cl+sl
print("no of capital letters:=",cl)
print("no of small letters:=",sl)
print("no of alphabets:=",al)
print("no of digits:=",di)
print("no of spaces:=",sp)
print("no of special characters:=",spl)
print("no of words:=",wo)
print("no of spaces:=",sp)"""
# 9printing reverse of the each word
"""
st=input("enter the string")
l=len(st)
ii=-1
l1=0
sub=""
for i in range(0,l,1):
if st[i]!=' ' :
sub+=st[i]
if i==(l-1) or st[i]==' ':
l1=len(sub)
for j in range(l1-1,-1,-1):
print(sub[j],sep=" ",end=' ')
print()
sub=""
"""
"""
st=input("enter the string")
l=len(st)
sub=""
for i in range(0,l,1):
if st[i]!=' ' :
sub=st[i]+sub
else:
print(sub)
sub=""
print(sub)
"""
# 10 find the length of the biggest word
"""
st=input("enter the string")
l=len(st)
maximum=0
c=0
sub=""
fs=""
for i in range(0,l,1):
if st[i]!=' ':
c+=1
sub+=st[i]
if st[i]==' ' or i==(l-1):
if c>maximum:
maximum=c
c=0
fs=sub
sub=""
else:
c=0
sub=""
print("the length of the biggest
word",fs,"is=",maximum)
"""
# 11 find the length of the smallest word
"""
st=input("enter the string")
l=len(st)
minimum=l
c=0
sub=""
fs=""
for i in range(0,l,1):
if st[i]!=' ':
c+=1
sub+=st[i]
if st[i]==' ' or i==(l-1):
if c<minimum:
minimum=c
c=0
fs=sub
sub=""
else:
c=0
sub=""
print("the length of the smallest
word",fs,"is=",minimum)
"""