Challenge
In this task you have to write a program that will take input an integer N (-1e9 <= N < 0 && 0 < N <= +1e9), then compute T = (abs(N) % M+1),if N is positive then output the T-th character from the beginning else output the T-th character from the end of your source.
M is the size of your source in bytes.
Example: If your source is: abcd efg/hi
Input:
2
Output:
c
Input:
-3
Output:
g
Input:
-9249678
Output:
b
Input:
-11
Output:
i
Constraints
- Don't use any FILE operation
- You can use any language of your choice
- Try to avoid or rather don't use 1 byte submissions, since it spoils all fun.
- Shortest solution wins!
EDIT: Problem statement have been modified so that the solutions could be judged using a random test-data (and same data for all solutions) hence please update your solution accordingly,sorry for the inconvenience (if any).
-2 -> /
-1 -> h
0 -> i
1 -> b
2 -> c
. But at least the mapping is now unanimous. \$\endgroup\$&&
in the first sentence is meant to be a||
? \$\endgroup\$