Want to solve programming problems and get paid for it? If that sounds interesting to you then contact us.
To resolve the issue with Scanner you need to check if there is a next line with hasNextLine()
so the loop becomes
while(sc.hasNextLine()){ str=sc.nextLine(); }
https://github.com/gradle/gradle/issues/3350