#C5330. String Processing and Palindrome Analysis

    ID: 48968 Type: Default 1000ms 256MiB

String Processing and Palindrome Analysis

String Processing and Palindrome Analysis

This problem involves processing an underscore-delimited string composed of lowercase English letters. You are required to split the string into words, calculate the total number of words, determine the length of the longest word, and count how many words are palindromes (i.e., words that remain unchanged when reversed).

Mathematically, let \(S\) be the input string and let \(W = \{w_1, w_2, \dots, w_k\}\) be the set of words obtained by splitting \(S\) at each underscore. You need to compute:

\(total = |W|\),

\(max\_length = \max_{1\le i \le k}\{|w_i|\}\), and

\(palindrome\_count = \sum_{i=1}^{k} I(w_i = reverse(w_i))\),

where \(I(condition)\) equals 1 if the condition is true and 0 otherwise.

inputFormat

A single line of input containing an underscore-delimited string of lowercase English letters.

outputFormat

A single line of output containing three space-separated integers: (1) the total number of words, (2) the length of the longest word, and (3) the count of palindromic words.## sample

hello_world
2 5 0