Word search

Your task is to write a program, that for each word search given, prints how many times appears the word "OIE" inside of it, horizontally, verticaly, or in diagonal. (In total, you must check 8 different senses.)

Input

The input consists of a series of cases. Each case consists of two numbers rr and cc, both of them between 1 and 100, followed by rr rows with cc uppercase letters each one.

Output

For each word search, your program must print how many times appears "OIE" inside of it.

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T12:05:25.564Z

© Jutge.org, 2006–2026.
https://jutge.org