At least 5 numbers ABCA X76654


Statement
 

pdf   zip

thehtml

Write a program which given a sequence without sentinel of naturals returns "SI" if in the sequence there are at least five numbers of four digits with the first digit equal to the last digit, and "NO" otherwise.

Input A sequence of naturals without sentinel.

Output A line with "SI" or "NO".

Observation

Public test cases
  • Input

    1000
    2000
    3000
    4000
    5000
    112
    1001
    2002

    Output

    NO
  • Input

    10000
    20000
    1231
    2342
    100
    2542
    3453
    4554
    100
    200
    399
    499
    5555

    Output

    SI
  • Information
    Author
    PRO1
    Language
    English
    Translator
    Original language
    Catalan
    Other languages
    Catalan Spanish
    Official solutions
    C++
    User solutions
    C++