Each cell was filled with a specific color denoted by single character eg. for blue -‘B’. If one position is clicked (x,y), colour present at that position would be deleted.If the same colour is present in neighbourhood (up/down/left/right) then it would also be deleted. After deletion blank spaces will be replaced by the value present in the cell above that. In case no value present above the cell then blank entry will be replaced by 0.
Input
x:1 y:1
BGB
BGG
BBB
Output
B00
B0B
BBB