String AnalyzerEasy

String Analyzer

EasyPractice library · +10 XPstringscountingsimple parsing

Given a string $S$ consisting of lowercase English letters, perform the following operations:

  1. Count the total number of characters in $S$.
  2. Count the number of occurrences of the character 'a' in $S$.
  3. Count the number of occurrences of the character 'z' in $S$.
  4. Determine if the first character of $S$ is the same as the last character of $S$. Print these four values on a single line, separated by spaces, in the order specified above.

Input

A single line containing the string $S$ (1 <= |S| <= 1000).

Output

A single line with four space-separated integers: total length, count of 'a', count of 'z', and 1 if the first and last characters are the same, 0 otherwise.

Constraints

|S| <= 1000

Time limit 1 s (native code; slower languages get more)Memory 256 MB15 hidden tests

Example 1

Input
banana
Output
6 3 0 0

String 'banana': length 6, 3 'a's, 0 'z's, first 'b' != last 'a'.

Example 2

Input
azaza
Output
5 3 2 1

String 'azaza': length 5, 2 'a's, 2 'z's, first 'a' == last 'a'.

Hints