It all depends on which methods you use, and what the data is like. A method like Scanner.nextLine() (used in the solution above) is usually pretty innocuous - but it reads everything up to the next line separator, or EOF. What if the input doesn't have any newlines, just a really long stream of characters? Then you're forcing the Scanner to load the whole thing into memory at once. Whereas with BufferedReader you can break the input up into reasonably-sized chunks. It may be that the instructor / tester / whatever is using a
test framework that intentionally creates a really long input. They could also run the JVM with a smaller-than-usual heap size, in order to force memory efficiency.
I think the use of StringBuilder here is still problematic, because just like with ArrayList, there is a performance issue if you are inserting characters in the front or middle of the StringBuilder. Inserting at the end is fast, but anywhere else, you're also shifting the contents of everything after your insert. That's why I advocate using LinkedList.
Still, it seems this issue wasn't big enough to prevent you from a successful submission, so congratulations!