Input functionality for Algorithm.java