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”.
Input
hi how are you beginning we are inside yes we are inside end bye
Output
7
Input
hello beginning bye
Output
wrong sequence