This page is still under construction.

Parts of this page are still being built. What you see may change.

One Shot at Life

Time limit1sMemory limit1024 MB

Summary
Decide whether a string of uppercase letters has a run of 5 or more characters where each adjacent pair is alphabetically consecutive.
Level

Easy2 of 10

Topics
String, Simulation
Solved
No attempts yet

Problem

Jaehyung bought a lotto ticket today too, hoping to turn his life around. Each ticket is a string of NN uppercase letters written in a row. To win, the string must contain a substring of length 55 or more in which every pair of adjacent characters is adjacent in alphabetical order. For example, the alphabetical neighbors of 'C' are 'B' and 'D', the only neighbor of 'Z' is 'Y', and no letter is its own neighbor. So the tickets "ABCDE", "ASGXYZYXE", and "WEFGHIJKA" win, while "ABCDF", "CXYZAB", and "AAAAA" do not. Given a string of NN uppercase letters, determine whether the ticket wins.

Input

The first line contains NN (5≤N≤100 0005 \leq N \leq 100\,000), the length of the lotto string. The second line contains the lotto string SS.

Output

If the ticket wins, print YES. Otherwise, print NO.

Hint

A substring of SS is a contiguous part of the string.

Examples3

  1. Example 1

    Input
    10
    ABABAWILSF
    
    Expected output
    YES
    
  2. Example 2

    Input
    10
    SOGAAAAANG
    
    Expected output
    NO
    
  3. Example 3

    Input
    10
    WEABCBCDEP
    
    Expected output
    YES