you are given a string representing a sequence of n arrows