split input into different indexes based on tag name