#include <stdio.h> int main() { char arr[3][3] = {0}; int i = 0; int j = 0; int count = 0; for (i = 0; i < 3; i++) { for (j = 0; j < 3; j++) { scanf("%c ", &arr[i][j]); } } for (i = 0; i < 3; i++)//行 { if (arr[i][0] == arr[i][1] && arr[i][1] == arr[i][2]) { if (arr[i][0] == 'K') { printf("KiKi wins!\n"); count++; } if (arr[i][0] == 'B') { printf("BoBo wins!\n"); count++; } } } for (j = 0; j < 3;j++)//列 { if (arr[0][j] == arr[1][j] && arr[1][j] == arr[2][j]) { if (arr[0][j] == 'K') { printf("KiKi wins!\n"); count++; } if (arr[0][j] == 'B') { printf("BoBo wins!\n"); count++; } } } //正对角线 if (arr[0][0] == arr[1][1] && arr[1][1] == arr[2][2]) { if (arr[0][0] == 'K') { printf("KiKi wins!\n"); count++; } if (arr[0][0] == 'B') { printf("BoBo wins!\n"); count++; } } //反对角线 if (arr[0][2] == arr[1][1] && arr[1][1] == arr[2][0]) { if (arr[1][1] == 'K') { printf("KiKi wins!\n"); count++; } if (arr[1][1] == 'B') { printf("BoBo wins!\n"); count++; } } if (count == 0) { printf("No winner!\n"); } return 0; }