Write a program or function (or equivalent) that sorts out and returns the odd letter in the matrix of random size.
You will be passed a matrix (as a string) as input of random dimensions such as this.
bbbbbbbbbb bbbbbdbbbb bbbbbbbbbb bbbbbbbbbb bbbbbbbbbb
Your job is to find the letter that doesn't match the rest (in this case, it is
d, found at line 2, col 6) and to return that letter as output. The matrix will consist of letters
a-z, newlines (
\n, only on ends of rows) and have dimensions ranging from 5x5 to 10x10 (25-100 letters).
Standard loopholes apply. This is a code golf challenge; entry with code of least bytes wins.
Input will be passed in through standard input as a string if it is a program or as an argument if a function (or similar).
A single character that is the "odd" in the matrix or
NUL, or the string
"None" if there is no "odd" character.
AAAAAAA AAAAAAA AAAAAAA AAAIAAA AAAAAAA
vvqvvvvvvv vvvvvvvvvv vvvvvvvvvv vvvvvvvvvv vvvvvvvvvv
puuuuuuuu uuuuuuuuu uuuuuuuuu uuuuuuuuu uuuuuuuuu uuuuuuuuu uuuuuuuuu uuuuuuuuu uuuuuuuuu uuuuuuuuu
Here is a random matrix generator written in Python that you can use to test your program. Note: There is a slight chance that it could make a mistake and not put in an odd letter.
Instructions 1. Copy this code into a file called `matrix_gen.py`. 2. Run it with `python matrix_gen.py`. --- from random import randint rows = randint(5,10) cols = randint(5,10) charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" neg = charset[randint(0,51)] pos = charset[randint(0,51)] p_used = 0 comp = 0 matrix = "" while comp < rows: row = "" while len(row) < cols: if not p_used and not randint(0,10): p_used = 1 row = row + pos else: row = row + neg row = row + "\n" matrix = matrix + row comp += 1 print matrix[:-1]