Words between two words

Write a program that, given a sequence of words, prints the number of words between the word “beginning” and the word “end”. If the word “beginning”, the word “end” or both words are missing, or if they appear in inverse order, tell so.

Input

Input consists of several words. The words “beginning” and “end” appear, at most, once.

Output

Print the number of words between the word “beginning” and the word “end”, if these appear in this order. Otherwise, print “wrong sequence”.

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T10:01:09.935Z

© Jutge.org, 2006–2026.
https://jutge.org