Special alphabetical order Infosys springboard coding question with solution
Problem Statement :
Given a non-empty string instr containing only alphabets, print the string outstr by arranging the alphabets of instr in the following order:
i.e. all occurrences of ‘A’ in instr will come first, followed by all occurrences of ‘a’, then all occurrences of ‘B’ and so on.
Read the string instr from the standard input stream.
Print outstr to the standard output stream.
Code Solution :
instr =input() outstr = '' for i in 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz': for j in instr: if i == j: outstr+=i print(outstr)