#include #include int main() { int n, m, flag = 0; char** s; if (scanf("%d %d", &n, &m) != 2) { return -1; } s = (char**)malloc(sizeof(char*) * n); if (s == NULL) { return -1; } for (int i = 0; i < n; i++) { *(s + i) = (char*)malloc(sizeof(char) * m + 1); if (scanf("%s", *(s + i)) != 1) { return -1; } if (*(s + i) == NULL) { return -1; } } if (m > 3) { for (int i = 0; i < n; i++) { for (int j = 0; j < m - 3; j++) { if (*(*(s + i) + j + 0) == 'L' && *(*(s + i) + j + 1) == 'O' && *(*(s + i) + j + 2) == 'V' && *(*(s + i) + j + 3) == 'E') { flag = 1; break; } } if (flag == 1) { break; } } } if (flag == 1) { printf("YES"); } else { printf("NO"); } for (int i = 0; i < n; i++) { free(*(s + i)); *(s + i) = NULL; } free(s); s = NULL; return 0; }