#C4449. Math Topic Categorizer

    ID: 47988 Type: Default 1000ms 256MiB

Math Topic Categorizer

Math Topic Categorizer

You are given a message that may contain some mathematical keywords. Your task is to analyze the message and determine which math topics it refers to. There are three possible categories:

  • Algebra: triggered by keywords such as algebra, equation, or variable.
  • Geometry: triggered by keywords such as geometry, triangle, circle, or square.
  • Calculus: triggered by keywords such as calculus, integral, derivative, or limit.

If the message does not contain any of these keywords, print an empty list.

The matching is case-insensitive. The output should be formatted in the Python list style. For example, if only algebra is detected, the output should be ['algebra']. In case multiple categories are detected, list them in the order: algebra, geometry, calculus.

Note: If a keyword appears as a substring of another word, it should still be considered a match. For example, the word variable in "variable equations" triggers Algebra.

In mathematical terms, for each category with keywords \(K\), you need to check if

\[ \bigvee_{k \in K} (k \subseteq \text{lowercase(message)}) \]

and include the corresponding category if true.

inputFormat

The input consists of a single line, which is the message string to analyze. Read from standard input (stdin).

outputFormat

Output a Python-style list of categories (e.g. ['algebra'] or []) as a single line to standard output (stdout). The order of categories must be: algebra, geometry, calculus.

## sample
I'm struggling with variable equations in algebra.
['algebra']