Number of characters skipped determines code printed [closed]

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.

closed as unclear what you're asking by AdmBorkBork, caird coinheringaahing, xnor, Arnauld, HyperNeutrinoOct 16 at 14:26

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• I'm sure I've seen a challenge like this before, but I have to question the "code golf" aspect: Fewer characters (say, a 2 byte program) would never need to output 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 output 0 with 0 or 1 bytes (and is not challenging). – Draco18s Oct 15 at 17:47
• How is n=1 "fobr"? If I understand the challenge it should be "foa" because you remove each character in parenthesis: f(o)o(b)a(r) – DJMcMayhem Oct 15 at 17:50
• Ooooh, this is a radiation-hardening type problem. I thought it was printing every n characters of the input or something. – Veskah Oct 15 at 17:51
• Welcome to Code Golf SE! We have a sandbox where you can post a potential challenge and get meaningful feedback before posting it to Main, which can help clear up questions such as the ones currently in the comments. – AdmBorkBork Oct 15 at 18:01
• I'm trying to understand this challenge a bit better.Are you portraying that foobar is the theoretical source code, and skipping every character of the original source code, foobar, resulting in foa, would print a different result? – booshlinux Oct 15 at 22:23