import re for i in ['NaCl', 'H2CO3']: print(re.findall('[A-Z][^A-Z]*', i))
Standard input is empty
['Na', 'Cl'] ['H2', 'C', 'O3']
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!