#K48857. Taco String Operations

    ID: 28513 Type: Default 1000ms 256MiB

Taco String Operations

Taco String Operations

You are given an integer \(N\) and an action number \(x\), along with \(N\) strings. Your task is to perform one of the following operations on the array of strings depending on the value of \(x\). The available operations are:

  1. \(x = 1\): Print the length of the longest string in the array.
  2. \(x = 2\): Compare the first characters of the first two strings. Print First Same if they match; otherwise, print First Different.
  3. \(x = 3\): Concatenate the first three strings and print the resulting string.
  4. \(x = 4\): For each string that contains the character 'a', print the string on a new line.
  5. \(x = 5\): Print the sum of the lengths of all strings.
  6. \(x = 6\): Reverse each string and print all the reversed strings in one line, separated by a single space.
  7. \(x = 7\): Start at index \(0\) and repeatedly set the index to the length of the current string. When the index goes out of bounds, print Out.

Note: All formulas in this description are expressed in \(\LaTeX\) format.

For example, if \(N = 5\), \(x = 1\), and the strings are:

apple
banana
carrot
date
egg

then the output should be 6 since "banana" is the longest string with 6 characters.

inputFormat

The first line of input contains two integers \(N\) and \(x\) separated by a space. The following \(N\) lines each contain one string which forms the array \(B\).

outputFormat

Print the result of the operation specified by \(x\) to standard output. The output format depends on the operation being performed.

## sample
5 1
apple
banana
carrot
date
egg
6