Given a rectangular haystack of size at least 2x2 composed of all the same printable ASCII characters, output the location (counting from the top-left) of the needle which is a different character.
For example, if the following haystack is input:
#####
###N#
#####
#####
The output should be 3,1
when zero-indexed (what I'll be using in this challenge) or 4,2
when one-indexed.
The haystack can be composed of any printable ASCII character:
^^^
^^^
^N^
^^^
^^^
^^^
output: 1,2
and the needle will be any other printable ASCII character:
jjjjjj
j@jjjj
jjjjjj
output 1,1
It's also possible to have a needle in the corner:
Z8
88
output 0,0
88
8Z
output 1,1
or to have the needle at the edge:
>>>>>>>>>>
>>>>>>>>>:
>>>>>>>>>>
output 9,1
Rules and Clarifications
- Input and output can be given by any convenient method. This means you can take input as a list of list of characters, as a single string, etc.
- You can print the result to STDOUT or return it as a function result. Please state in your submission what order the output is in (i.e., horizontal then vertical, as used in the challenge, or vice versa).
- Either a full program or a function are acceptable.
- You do not get to pick which characters to use. That's the challenge.
- The haystack is guaranteed to be at least 2x2 in size, so it's unambiguous which is the needle and which is the hay.
- There is only ever one needle in the input, and it's only ever one character in size.
- Standard loopholes are forbidden.
- This is code-golf so all usual golfing rules apply, and the shortest code (in bytes) wins.
88\n8Z
(with any two characters of course). \$\endgroup\$("########N###########", 5)
\$\endgroup\$