Alphabetical Order Pattern
Coding Problem Keys
Alphabetical Order Pattern
Problem Statement
The program must accept a string S containing only alphabets as the input. The program must print all the alphabets of S in alphabetical order with respect to their positions as shown in the Example Input/Output Section.
Input Format
The first line contains the value of S.
Output Format
The first line contains the desired pattern as shown in the Example Input/Output Section.Constraints
3 <= Length of S <= 100Example Input/Output 1
Input
TenthOutput
*e***
****h
**n**
T**t*
Example Input/Output 2
Input
SkillRackOutput
******a**
*******c*
**i******
*k******k
***ll****
*****R***
S********
Max Execution Time Limit: 500 millisecs
Solution
Programming Language: Python 3 Language
l=input().strip()
k=[x.lower() for x in l]
d=0
f=sorted(list(set(k)))
for i in range(len(f)):
p=""
for j in l:
if(j.lower()==f[d]):
p+=j
else:
p+="*"
d+=1
print(p)
# Published By PKJCODERS
(Note: Incase If the code doesn't Pass the output kindly comment us with your feedback to help us improvise.)
Comments