info

MAPS OS v1.1.4 © 2025

Glory to the Segtree

Glory to the Algorithm.

Word SearchGo home

Login to view input

no submission

Login to submit an answer

Problem Leaderboard

Problem Leaderboard

Word Search

You are given an n by m word search, and are tasked with finding which of the following words appear in the word search. Words can appear left-to-right, top-to-bottom, and top-left to bottom-right diagonally.

These are the words that you will be looking for:

MONASH
ALGORITHMS
PROBLEM
SOLVING
DIVIDEANDCONQUER
BINARYSEARCH
FENWICKTREE
SEGMENTTREE
DISJOINTSETUNION
DYNAMICPROGRAMMING
KNUTHSOPTIMIZATION
CONVEXHULLTRICK
LINEARSIEVE
MODULAREXPONENTIATION
DIJKSTRALGORITHM
BELLMANFORDALGORITHM
FLOYDWARSHALL
TOPOSORT
STRONGCONNECTEDCOMPONENTS
BIPARTITEMATCHING
HUNGARIANALGORITHM
MINCOSTMAXFLOW
ARTICULATIONPOINT
BRIDGEOFGRAPH
LCAWITHBINARYLIFTING
HEAVYLIGHTDECOMPOSITION
ROLLINGHASH
KMPALGORITHM
AHOCORASICK
TRIESTRUCTURE
MONOTONESTACK
MONOTONEQUEUE

The first line contains integers n and m, the number of rows and columns respectively. The following n lines contains each row of the word search, containing m space separated characters.

Please output each of the words that appear in lexicographical order, separated by commas.

Sample Input:

2 7
S O L V I N G
P R O B L E M

Sample Output:

PROBLEM,SOLVING