local tmp = io.read("l") .. ' @'
local prev = ' '
local c = ' '
local cnt = 0
for i=1,#tmp do
    c = string.sub(tmp, i, i)
    if c == ' ' then
        if prev == string.sub(tmp, i+1,i+1) then
            cnt = cnt + 1
            if cnt == 2 then
                print('YES')
                return
            end
        else
            print('NO')
            return
        end
    end
    prev = c
end
