Go: package main

import (
	"bufio"
	"os"
	"strings"
	"strconv"
	"reflect"
	"fmt"
)

var scanner = bufio.NewScanner(os.Stdin)

func scanBoard() [][]int {
	ret := make([][]int, 8)
	for k := range ret {
		ret[k] = make([]int, 8)
		for l := range ret[k] {
			ret[k][l] = 0
		}
	}
	for i := 0; i < 8; i++ {
		scanner.Scan()
		row := strings.Split(scanner.Text(), "")
		if reflect.DeepEqual(row, []string{}) {
			break
		}
		for j := 0; j < 8; j++ {
			ret[i][j], _ = strconv.Atoi(row[j])
		}
	}
	return ret
}

var emptyBoard = [][]int{{0,0,0,0,0,0,0,0},
						 {0,0,0,0,0,0,0,0},
						 {0,0,0,0,0,0,0,0},
	                     {0,0,0,0,0,0,0,0},
	                     {0,0,0,0,0,0,0,0},
	                     {0,0,0,0,0,0,0,0},
	                     {0,0,0,0,0,0,0,0},
	                     {0,0,0,0,0,0,0,0}}

func main() {
	for {
		var board [][]int
		var ans string
		if board = scanBoard(); reflect.DeepEqual(board, emptyBoard) {
			break
		}
		// fmt.Println(board)
		for i := 0; i < 7; i++ {
			for j := 0; j < 7; j++ {
				if board[i][j] == 1 && board[i+1][j] == 1 && board[i][j+1] == 1 && board[i+1][j+1] == 1 {
					ans = "A"
				}
			}
		}
		for i := 0; i < 5; i++ {
			for j := 0; j < 8; j++ {
				if board[i][j] == 1 && board[i+1][j] == 1 && board[i+2][j] == 1 && board[i+3][j] == 1 {
					ans = "B"
				}
			}
		}
		for i := 0; i < 8; i++ {
			for j := 0; j < 5; j++ {
				if board[i][j] == 1 && board[i][j+1] == 1 && board[i][j+2] == 1 && board[i][j+3] == 1 {
					ans = "C"
				}
			}
		}
		for i := 0; i < 6; i++ {
			for j := 0; j < 7; j++ {
				if board[i][j+1] == 1 && board[i+1][j] == 1 && board[i+1][j+1] == 1 && board[i+2][j] == 1 {
					ans = "D"
				}
			}
		}
		for i := 0; i < 7; i++ {
			for j := 0; j < 6; j++ {
				if board[i][j] == 1 && board[i][j+1] == 1 && board[i+1][j+1] == 1 && board[i+1][j+2] == 1 {
					ans = "E"
				}
			}
		}
		for i := 0; i < 7; i++ {
			for j := 0; j < 6; j++ {
				if board[i][j+1] == 1 && board[i][j+2] == 1 && board[i+1][j] == 1 && board[i+1][j+1] == 1 {
					ans = "G"
				}
			}
		}
		for i := 0; i < 6; i++ {
			for j := 0; j < 7; j++ {
				if board[i][j] == 1 && board[i+1][j] == 1 && board[i+1][j+1] == 1 && board[i+2][j+1] == 1 {
					ans = "F"
				}
			}
		}
		fmt.Println(ans)
		fmt.Scanln()
	}
}

Python: import sys
line=[]
in_line=sys.stdin
for _in in in_line:line.append(_in)
#for i in range(26):line.append(input())
sets=(len(line)+1)//9
for i in range(sets):
    flag=0
    topindex=-1
    for j in range(i*9,i*9+8):
        a=line[j].count('1')
        if a!=0:t=line[j].index('1')
        else:t=-1
        if a==4:
            print('C')
            break
        elif flag==0 and a!=0:
            topindex=t
            if a==1:flag=1
            elif a==2:flag=2
        elif flag==1:
            if a==1:
                print('B')
                break
            elif a==2:
                if topindex==t:
                    print('F')
                    break
                else:
                    print('D')
                    break
        elif flag==2:
            if topindex==t:
                print('A')
                break
            elif topindex<t:
                print('E')
                break
            else:
                print('G')

Python: while 1:
 a=[list(map(int,input()))for _ in[0]*8]
 y=[sum(r)for r in a]
 x=[sum(c)for c in zip(*a)]
 print('B'if 4 in x else'C'if 4 in y else'DF'[a[y.index(1)][x.index(2)]]if 1 in y else'GE'[a[y.index(2)][x.index(1)]]if 1 in x else'A')
 try:input()
 except:break

Python: def judge(array):
    count = [[0 for i in range(8)] for i in range(8)]
    for i in range(8):
        x = 0
        for j in array[i]:
            if int(j) == 1:
                count[i][x] += 1
            x += 1

    a = 0
    p = []
    for i in range(8):
        for j in range(8):
            if count[i][j] != 0:
                p.append(a)
            a += 1

    if p[0]+1 != p[1]:
        if p[0] + 8*3 == p[3]:
            print('B')
        else:
            if p[0] + 8*2 + 1 == p[3]:
                print('F')
            else:
                print('D')
    else:
        if p[0]+1 == p[1] and p[1]+1 == p[2]:
            print('C')
        else:
            if p[0] + 8 == p[2] and p[1] + 8 == p[3]:
                print('A')
            else:
                if p[0]+8 == p[3]:
                    print('G')
                else:
                    print('E')
                    
while True:
    try:
        array = []
        for i in range(8):
            array.append(input())
        judge(array)
        input()
    except:
        break

Python: while True:
    squares = [list(input()) for _ in range(8)]
    for i in range(8)[::-1]:
        if not squares[i].count('1'):
            del squares[i]
    for i in range(8)[::-1]:
        if not [line[i] for line in squares].count('1'):
            for j in range(len(squares)):
                del squares[j][i]
    if len(squares) == len(squares[0]):
        print('A')
    elif len(squares) == 4:
        print('B')
    elif len(squares) == 1:
        print('C')
    elif squares[0] == ['0', '1']:
        print('D')
    elif squares[0] == ['1', '1', '0']:
        print('E')
    elif squares[0] == ['1', '0']:
        print('F')
    elif squares[0] == ['0', '1', '1']:
        print('G')
    try:
        input()
    except:
        break

Python: import sys
 
counter = 0
block = []
for line in sys.stdin:
  if line == "\n":
    counter = -1
    block = []
  else:
    counter += 1
    for i in line:
      if i == "1":
        block.append([counter,line.index(i)])
  if counter == 7:
    if block[0][0] == block[1][0]:
      if block[1][0] == block[2][0]:
        print("C")
      elif block[0][1] == block[2][1]:
        print("A")
      elif block[0][1] < block[2][1]:
        print("E")
      else:
        print("G")
    else:
      if block[0][1] == block[3][1]:
        print("B")
      elif block[0][1] < block[3][1]:
        print("F")
      else:
        print("D")

Python: # -*- coding: utf-8 -*-
"""
Spyder Editor

This is a temporary script file.
"""

s=[[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],[0,1,1,0,0,0,0,0],[0,0,1,1,0,0,0,0],[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0]]
s2=[[0,0,0,1,1,1,1,0],[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0]]
s3=[[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],[0,0,1,1,0,0,0,0],[0,0,1,1,0,0,0,0],[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0]]

#はじめに1に当たる座標のみを取得し、その座標の右隣り＝r、下隣=b、みぎした隣=nより探索する
def Sakana(s):
    for i in range(0,len(s)-1):
        #print ("a")
        for o in range(0,len(s[i])-1):
            #print (s[i][o])
            if s[i][o]==1:
                #下
                b=s[i+1][o]
                #右
                r=s[i][o+1]
                #右斜めした
                n=s[i+1][o+1]
                    
                #判定
                if b==1 and r==1 and n==1:
                    return "A"
                if b==1 and r==1 and n==0:
                    return "G"
                if b==0 and r==1 and n==0:
                    return "C"
                if b==1 and r==0 and n==0:
                    if s[i+2][o] == 0:
                        return "D"
                    else:
                        return "B"
                if b==1 and r==0 and n==1:
                    return "F"
                if b==0 and r==1 and n==1:
                    return "E"
                break

print(Sakana(s))
print(Sakana(s2))
print(Sakana(s3))