Cannot edit old clash


#1

This Lua solution should work for this clash
https://www.codingame.com/contribute/view/1193a2b420e71f797b05a0898e60f4cd7e

s=io.read():gsub("%s", "")
c=io.read"n"
for i = 1, #s+#s%c, c do
    print(s:sub(i,i+c-1))
end

but it complains in 2 test cases and validators about a trailing newline.
The main problem here is that I can’t edit the clash. Why can’t I edit this clash? I can edit other clashes.


#2

It’s not editable because it’s an “old” contribution that was made before the current contribution system.

That said, it’s strange as the output comparison should not take into account the last \n anyway (so that the fact that the expected output ends with one or none should not matter)… And it seems to work well in (at least some) other languages, while here with Lua you need to do something like this to pass:

for i = 1, #s+#s%c, c do
    if i>1 then io.write('\n') end
    io.write(s:sub(i,i+c-1))
end

EDIT: Actually you messed up the loop bounds (I didn’t pay attention to that). The following passes:

for i = 1, #s, c do
    print(s:sub(i,i+c-1))
end

#3

I see, I meant to write #s + (c - #s)%c so I actually was outputting an extra newline for those particular cases. Still, being able to edit it to inspect the test cases more closely would have been helpful.