In Algelandia, the favorite pastime is the Word Search puzzles. One of these has the following characteristics:
- The words occur only in the direction of the secondary diagonal;
- Words can occur with uppercase and/or lowercase;
- If a given word exists, it occurs only once and at any position on the diagonal;
- Words can exist in both normal and inverted form, that is, the diagonal reading could be top-down or bottom-up form.
In this context, the figure below demonstrates how the words “workshop”, “videogame” and “scanner” can occur in the game.
Input
Output
Depending on the existence of each N-word, inform:
- 1 Palavra "X" na diagonal secundaria
- 2 Palavra "X" acima da diagonal secundaria
- 3 Palavra "X" abaixo da diagonal secundaria
- 4 Palavra "X" inexistente
Where X is the searched word, moreover, X must be in lower case.
Input Sample |
Output Sample |
7 20 20
equivocado
maturidade
prescindir
insight
designer
efemero
feeling
SkCaBhRgVjAsDsHeJcEk
FuNmHdIkWiJsOaRmStPm
RwOuHsGOLcHtWtRvBeAf
MaHuQnRwJbIoAbJrXjXt
IoUjIEVgDdJeAvEpTbAv
IuAlmvBresDppdEmRnSh
QreEUrTSRcOraQAuJgNl
BEfpQaitBnEdUdLqMpWp
FeXgMgWoAsIiAnIpIfAm
AfGqnvBkCrVkNnKgXmKj
XoNeIoKIuoRxSsUqOsFn
NirsItntCcCiXfWsDnMq
SmGlEdAAVgGvCiSeEpKb
VeNlIMDjMhMgBmHgGrLw
OmBrIoGateVcXgTbPfXo
HaAjAfKiEdRuMgXgQwFv
VtWrWsSuNvFwGlWrLuWi
BeJbRqGuXkHrJsMnGlCc
RwXbViXmUdMeIpQgKvOe
GvTmJjWfRmJkVcVgVrCr
|
1 Palavra "equivocado" na diagonal secundaria
2 Palavra "maturidade" acima da diagonal secundaria
2 Palavra "prescindir" acima da diagonal secundaria
3 Palavra "insight" abaixo da diagonal secundaria
2 Palavra "designer" acima da diagonal secundaria
2 Palavra "efemero" acima da diagonal secundaria
2 Palavra "feeling" acima da diagonal secundaria
|