Question
Cookie Number
You are given an integer n. A number is called a Cookie Number if no two adjacent digits in it are the same. Determine whether the given number n is a Cookie Number or not.
Input
A single integer n.
Output
Print "Yes" if no two adjacent digits are the same, otherwise print "No".
Example
Example 1:
Input:
1213
Output:
Yes
Example 2:
Input:
1123
Output:
No
Example 3:
Input:
9876
Output:
Yes
Explanation :
1213: Adjacent pairs → (1,2), (2,1), (1,3). All pairs have distinct digits → Yes.
1123: Adjacent pair (1,1) contains identical digits → No.
9876: Every adjacent pair is distinct → Yes.
Input:
1213
Output:
Yes
Example 2:
Input:
1123
Output:
No
Example 3:
Input:
9876
Output:
Yes
Explanation :
1213: Adjacent pairs → (1,2), (2,1), (1,3). All pairs have distinct digits → Yes.
1123: Adjacent pair (1,1) contains identical digits → No.
9876: Every adjacent pair is distinct → Yes.