Problem:
Score : 100 points

Problem Statement

A string of length 6 consisting of lowercase English letters is said to be coffee-like if and only if its 3-rd and 4-th characters are equal and its 5-th and 6-th characters are also equal.

Given a string S, determine whether it is coffee-like.

Constraints

S is a string of length 6 consisting of lowercase English letters.

Input

Input is given from Standard Input in the following format:

S

Output

If S is coffee-like, print Yes; otherwise, print No.

Sample Input 1

sippuu

Sample Output 1

Yes

In sippuu, the 3-rd and 4-th characters are equal, and the 5-th and 6-th characters are also equal.

Sample Input 2

iphone

Sample Output 2

No

Sample Input 3

coffee

Sample Output 3

Yes

Solution in C++14 (GCC 5.4.1) (judge verdict: Runtime Error)

#include<iostream>
#include<stdio.h>
#include<string>
#include<cmath>
#include<vector>
#pragma warning(disable: 4996)
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;;
using ll = long long;

int main() {
	ll K, N ,ans=0,flag=0,sum=0;
	ll m = 10000001;
	ll R1, R2;
	cin >> K >> N;
	vector<ll> a(N);
	
	rep(i, N) {
		cin >> a[i];
		if (i > 0) {
			if (a[i] - a[i - 1] > sum) {
				sum = a[i] - a[i - 1];
				flag = i-1;
			}
		}
	}
	if (K - a[N - 1] > sum) {
		flag = N - 1;
	}
	if (flag != 0&&flag!=N-1) {
		 R1 = (K - a[flag]) + a[flag - 1];
		 R2 = a[flag] + (K - a[flag + 1]);
	}
	else if (flag == 0) {
		 R1 = a[N - 1] - a[0];
		 R2 = a[0] + (K - a[N - 1]) + (a[N - 1] - a[N - 2]);
	}
	else if (flag == N - 1) {
		R1 = K - (a[N - 1] - a[N - 2]);
		R2 = a[N - 1] - a[0];
	}
	if (R1 > R2) {
		ans = R2;
	}
	else if (R1 < R2) {
		ans = R1;
	}
	else {
		ans = R1;
	}

	cout << ans << endl;
	return 0;
}