Hah! I should have noticed the name was the same. Sorry about that :)
Checking for the right layout is difficult. Currently our approach in the C programming course is to require students to submit code that is laid out in according to the 1TBS style. We give them the astyle program and tell them to run their code through that before submitting. Then we have a style-checker phase within CodeRunner that verifies that their code is unaltered by again being run through astyle. If there are any differences, their submission is thrown out. We have both a Precheck and a Check button and the style checking is all done without penalty via the Precheck (and again by Check but they shouldn't be clicking that button if they have failed the Precheck).
The best way to prevent them circumventing the task by providing 6 different calls to Serial.print is probably to have multiple tests, with each test defining a global variable or perhaps a #define of the number of print calls required. Having at least one hidden test is always a good idea to prevent students constructing an artificial solution that works only for a known set of tests.
Alternatively, before running their code you can check that it satisfies various conditions such as (in this case) only a single Serial.print call.