better split function
solved problem 30