Problem: The task is to form a group of characters and print them in a specific order.
Given string: “HeLloOWorLDd”
(In order they appear in the string)
Group d -> Dd
Group l -> LlL
Group h ->
Group r -> r
Group o -> oOo ……..etc. Then arrange the Group in ascending order.
Explanation:
Sample Input:
HeLloOWorLDd
Sample Output:
DdWerHoOoLlL
Solution: We strongly recommend you to try the problem first before moving to the solution.
Python
# Code to understand Concatenation of Alphabetical group in Python
# www.codewindow.in
str_list=list(input())
char_list=[]
for i in range (len(str_list)):
if str_list[i]=='':
continue
char_grp=str_list[i]
for j in range (i+1, len(str_list)):
if str_list[i].lower()==str_list[j].lower():
char_grp += str_list[j]
str_list[j]=''
str_list[i]=''
char_list.append(char_grp)
for i in range (len(char_list)):
for j in range (i+1, len(char_list)):
if char_list[i].lower() > char_list[j].lower():
temp=char_list[j]
char_list[j]=char_list[i]
char_list[i]=temp
length=len(char_list)
for i in range (length//2):
print(char_list[i]+char_list[length-i-1], end='')
if length%2!=0:
print(char_list[length//2])
Input:
HeLloOWorLDd
Output:
DdWerHoOoLlL
Follow Us
You Missed
- Unlock Your Potential: Full Stack Developer Internship Opportunity at Futures First – Apply Now for Hands-On Experience and Growth – CodeWindow.in
- The Impact of Devin AI on the Future of Work
- The Impact of Devin AI on the Future of Work
- Unlocking Innovation and Diversity: Accenture HackDiva Empowers Women in Tech with Cutting-Edge Solutions – codewindow.in
- QA Engineer Opportunities at Siemens Company: Apply Now – codewindow.in
- QA Engineer Opportunities at Siemens Company: Apply Now – codewindow.in
- Software Engineer Positions at Siemens Company: Apply Now – codewindow.in
- Cloud Engineer II Opportunities at Insight Company: Apply Now – codewindow.in
- Shape Your Career: Assistant Engineer Opportunities at Jindal Company – codewindow.in
- Shape Your Future: Executive Opportunities at Jindal Company – cdewindow.in
- Unlock Your Potential: Full Stack Developer Internship Opportunity at Futures First – Apply Now for Hands-On Experience and Growth – Codewindow.in
- Associate Engineer, Software Development at Ingram: Apply Now – codewindow.in
- Jade Company’s UI/UX Development Engineer Opportunities – Apply Now – codewindow.in
- Transform Your Career with S&P Global: Apply for the Software Development Engineer Role and Lead the Future of Financial Technology Innovation – codewindow.in
- Unlock Your Potential at Accenture as an Associate Software Engineer – Elevate Your Career with Innovation and Excellence – codewindow.in
- Accelerate Your Career: Join NVIDIA’s Elite Software Engineering Internship Program and Shape the Future of Technology – codewindow.in
- C Programming Interview Questions – codewindow.in
- Lead the Way in Analytics: Specialist Position at Razorpay – codewindow.in
- Innovate with Cyient: Junior Software Engineer Wanted – codewindow.in
- Innovate with Volvo: Associate Software Engineer Wanted – codewindow.in
- Lead the Tech Revolution: Full Stack Developer at Unisys – codewindow.in
- Software Engineer at ABB: Unlock Innovation and Shape the Future – codewindow.in
- IBM Associate Systems Engineer Job: Boost Your Career with a Leading Technology Giant – codewindow.in
- Make Your Mark in Android Development: Join Concentrix – codewindow.in
- Infosys is Growing: Field Services Developer Role Now Open – codewindow.in
- Start Your IT Career Journey with Amazon: IT Services Support Associate I Opportunity – codewindow.in
- Shape the Future of Web: Front-End Software Engineer Opportunity at Google Cloud – codewindow.in
- Barclays QA Team Expands: QA Analyst Role Now Open- codewindow.in
- Eurofins QA Team Grows: Test Engineer Role Now Open – codewindow.in
- Exciting Opportunity: Java Spring Boot Senior Developer Role at Infosys – codewindow.in
- Unlock Your Potential at Nokia: Software Engineer Opportunities Await – codewindow.in
- Join Microsoft’s World-Class Team as a Software Engineer and Shape the Future of Technology – codewindow.in