```
public class Solution {
public int findLonelyPixel(char[][] picture) {
int m = picture.length, n = picture[0].length;
int[] row = new int[m];
int[] col = new int[n];
int res = 0;
for(int i = 0; i < m; i ++){
for(int j = 0; j < n; j ++){
if(picture[i][j] == 'B'){
col[j]++;
if(row[i] == 0) row[i] = j + 1;
else row[i] = -1;
}
}
}
for(int r : row){
if(r > 0 && col[r - 1] == 1) res++;
}
return res;
}
}
```