Note: click on newest button on top select old
Count no. of vowels ,consonants ,digits and spaces
a=list(input())
vowel=const=space=digit=0
for i in a:
if i in ['a','e','i','o','u','A','E','I','O','U']:
vowel+=1
elif i in ['1','2','3','4','5','6','7','8','9','0']:
digit+=1
elif i in ' ':
space+=1
else:
const+=1
print('Vowels:',vowel)
print('Consonants:',const)
print('Digits:',digit)
print('White spaces:',space)
Camel case word count
a=input()
count=0
for i in a:
if ord(i)<91:
count+=1
if ord(a[0])>94:
count+=1
print(count)
Count no.of words
a=input()
print(a.count(' ')+1)
counting the occurances
a=input()
b=input()
c=a.count(b)
if c:
print(c)
else:
print(-1)
Numbers in string
a=input()
count=0
for i in a:
if i in '1234567890':
count+=int(i)
print(count)
max of string
a=input()
print(max(a))
string concat
a=input()
b=input()
c=a+b
print(''.join(sorted(c)))
string contain digit or not
a=input()
count=0
for i in a:
if i.isdigit():
count+=1
if(count):
print('Contains',count,'digit')
else:
print('Doesn\'t contain digit')
Monk Teaches Palindrome
t=int(input())
for i in range(t):
s=input()
if s!=s[::-1]:
print('NO')
elif(len(s)%2==0):
print('YES EVEN')
else:
print('YES ODD')
String contains digit
t=int(input())
for i in range(t):
a=input()
for j in a:
if j.isdigit():
print('Yes')
break
else:
print('No')
To Lower
a=input()
print(a.lower())
Robot return to origin
a=input()
x=y=0
for i in a:
if i is 'L':
x-=1
elif i is 'R':
x+=1
elif i is 'U':
y+=1
else:
y-=1
print(x==0 and y==0)
Reverse Words in a String III
l=input().split(' ')
l2=[]
for i in l:
l2.append(i[::-1])
print(' '.join(l2))
Reverse string
a=input()
print(a[::-1])
Defanging an IP Address
a=input()
print(a.replace('.','[.]'))
goat latin
a=list(map(list,input().split()))
for i in range(len(a)):
if a[i][0] in ['a','e','i','o','u','A','E','I','O','U']:
a[i].append('ma')
else:
t=a[i][0]
a[i].pop(0)
a[i].append(t)
a[i].append('ma')
a[i].append('a'*(i+1))
for i in range(len(a)):
b="".join(a[i])
print(b,end=" ")
Ransom Note
def num(x,y):
for i in x:
if i in y:
y.remove(i)
else:
return False
return True
x,y=map(list,input().split())
print(num(x,y))
First Unique Character in a String
a=input()
for i in a:
j=a.index(i)
if i not in a[j+1:]:
print(j)
break
else:
print(-1)
Multiply Strings
a,b=map(int,input().split())
print(a*b)
Hello
a=input()
print('Hello Technicalhub')
print(a)
exact slice
a=input()
b=int(input())
c=int(input())
print(a[b:c+1])
string decimal
t=int(input())
for i in range(t):
a=input()
print(a.isnumeric())
string reverse
a=input().split()
print(' '.join(a[::-1]))
zoo
from collections import Counter
a=list(input())
b=dict(Counter(a))
x=b.get('z')
y=b.get('o')
if 2*x==y:
print('Yes')
else:
print('No')
First Non repeated character
t=int(input())
for i in range(t):
a=int(input())
s=input()
for i in s:
if i not in s[s.index(i)+1:]:
print(i)
break
else:
print(-1)
program to find sum
a=input()
sum=0
for i in a:
if i in '123456789':
sum+=int(i)
print(sum)
--------------------------------------------------not order from here------------------------------------
print all permutations
from itertools import permutations as p
a=input()
l=p(a)
for i in l:
print(''.join(i))