def check_if_won(matrix):
for row in matrix:
row_str = ''.join(str(x) for x in row)
if 'xxx' in row_str:
return True
for j in range(len(matrix[0])):
col_str = ''
col_str += matrix[0][j]
col_str += matrix[1][j]
col_str += matrix[2][j]
col_str += matrix[3][j]
if 'xxx' in col_str:
return True
dig1 = ''
dig1 += matrix[0][0]
dig1 += matrix[1][1]
dig1 += matrix[2][2]
dig1 += matrix[3][3]
if 'xxx' in dig1:
return True
dig2 = ''
dig2 += matrix[1][0]
dig2 += matrix[2][1]
dig2 += matrix[3][2]
if 'xxx' in dig2:
return True
dig3 = ''
dig3 += matrix[0][1]
dig3 += matrix[1][2]
dig3 += matrix[2][3]
if 'xxx' in dig3:
return True
dig_inv1 = ''
dig_inv1 += matrix[0][3]
dig_inv1 += matrix[1][2]
dig_inv1 += matrix[2][1]
dig_inv1 += matrix[3][0]
if 'xxx' in dig_inv1:
return True
dig_inv2 = ''
dig_inv2 += matrix[0][2]
dig_inv2 += matrix[1][1]
dig_inv2 += matrix[2][0]
if 'xxx' in dig_inv2:
return True
dig_inv3 = ''
dig_inv3 += matrix[1][3]
dig_inv3 += matrix[2][2]
dig_inv3 += matrix[3][1]
if 'xxx' in dig_inv3:
return True
return False
str1 = str(input())
str2 = str(input())
str3 = str(input())
str4 = str(input())
l1 = [c for c in str1]
l2 = [c for c in str2]
l3 = [c for c in str3]
l4 = [c for c in str4]
m = []
m.append(l1)
m.append(l2)
m.append(l3)
m.append(l4)
for i in range(len(m)):
for j in range(len(l1)):
if m[i][j] == '.':
m[i][j] = 'x'
won = check_if_won(m)
if won:
print('YES')
exit()
else:
m[i][j] = '.'
print('NO')
1529B - Sifid and Strange Subsequences | 1455C - Ping-pong |
1644C - Increase Subarray Sums | 1433A - Boring Apartments |
1428B - Belted Rooms | 519B - A and B and Compilation Errors |
1152B - Neko Performs Cat Furrier Transform | 1411A - In-game Chat |
119A - Epic Game | 703A - Mishka and Game |
1504C - Balance the Bits | 988A - Diverse Team |
1312B - Bogosort | 1616B - Mirror in the String |
1660C - Get an Even String | 489B - BerSU Ball |
977C - Less or Equal | 1505C - Fibonacci Words |
1660A - Vasya and Coins | 1660E - Matrix and Shifts |
1293B - JOE is on TV | 1584A - Mathematical Addition |
1660B - Vlad and Candies | 1472C - Long Jumps |
1293D - Aroma's Search | 918A - Eleven |
1237A - Balanced Rating Changes | 1616A - Integer Diversity |
1627B - Not Sitting | 1663C - Pōja Verdon |