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 JavaScript (node.js v5.12) (judge verdict: Wrong Answer)

function main(input) {
  function dist(a, b) {
		return Math.min(b-a, Math.abs(x-a)+Math.abs(y-b)+1);
	}
	
  const inp = input.split(' ');
	const n = inp[0];
	const x = inp[1];
	const y = inp[2];
  
  for(var i=1;i<n; i++) {
    var cnt = 0;
    
    for(var a=1; a<n; a++)
      for(var b=a+1; b<=n; b++)
        if(dist(a,b) == i)
          cnt++;
    
    console.log(cnt);
  }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));