java.util.NoSuchElementException: No line found
with Scanner you need to check if there is a next line with hasNextLine() so the loop becomes it’s readers that return null on EOF ofcourse in this piece of code this is dependent on whether the input is properly formatted