Sobes.tech
Junior — Middle+

Develop a class with a set of methods for text analysis

livecode

Task condition

Create a class that takes a string of text as input. The class should contain the following methods:

  1. A method that outputs the longest word from the given text.
  2. A method that finds and outputs the word that occurs the most times in the text.
  3. A method that counts the number of special characters (e.g., periods, commas, exclamation marks, etc.) and outputs this number.
  4. A method that collects all palindromic words and outputs them in a single string separated by commas.

All methods work with the same text that was passed when creating an instance of the class.