How to divide the input into 3-5 parts?