Hey guys!

I've got a small problem that I can't figure out. I have 2D arrays of arbitrary sizes, and they contain different characters representing different stuff (like 'a', 'b', 'c' etc.). Now, the problem is, I need to find horizontal and vertical lines of same characters and make new arrays from them without using the same coordinate twice. For example:

```
0 1 2 3 4 . . .
0 a a a a a
1 a
2 a a a a
3 a
4 a
.
.
```

This would result like this:

```
Array 1:
0 1 2 3 4
0 a a a a a
1
2
3
4
Array 2:
0 1 2 3 4
0
1 a
2 a
3 a
4 a
Array 3:
0 1 2 3 4
0
1
2 a a a
3
4
```

It doesn't matter how the resulting arrays are formed, as long as they are, and they don't share a coordinate. How should I go on doing this?

Thanks in advance :)