Word search P94262


Statement
 

pdf   zip

html

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 r and c, both of them between 1 and 100, followed by r rows with c uppercase letters each one.

Output

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

Public test cases
  • Input

    3 3
    OIE
    IIX
    EXE
    
    1 10
    EIOIEIOEIO
    
    5 5
    EAEAE
    AIIIA
    EIOIE
    AIIIA
    EAEAE
    
    7 2
    OX
    IO
    EX
    II
    OX
    IE
    EX
    
    1 1
    E
    

    Output

    3
    4
    8
    3
    0
    
  • Information
    Author
    Omer Giménez
    Language
    English
    Translator
    Carlos Molina
    Original language
    Spanish
    Other languages
    Spanish
    Official solutions
    C++
    User solutions
    C++