Write a program which, when every nth character is skipped, it prints n. For example, if every 2nd character is skipped, it prints 2.
Example
n=0
foobar
Output:
0
n=1
foa
Output:
1
n=2
fobr
Output:
2
Rules
- If n=0 (no characters are skipped), 0 must be returned.
- Must print to STDOUT.
- Standard loopholes are forbidden.
- The first character is never skipped.
- Obviously, it doesn't need to work for more characters than the code has (e.g. if your code is 11 characters long, it doesn't need to work for every 11th character)
Scoring
This is code golf, so the shortest code in bytes wins.
3
because there would be no 3rd character. I'm pretty sure the older challenge was to output as many different results as when programs got longer there were more collisions to deal with. Shorter just gives an advantage to languages that can output0
with 0 or 1 bytes (and is not challenging). \$\endgroup\$f(o)o(b)a(r)
\$\endgroup\$foobar
is the theoretical source code, and skipping every character of the original source code,foobar
, resulting infoa
, would print a different result? \$\endgroup\$