#!/bin/sh
read S
S1=${S:0:1}
S2=${S:1:1}
S3=${S:2:1}
S4=${S:3:1}
if [ $S1 == $S2 -a $S3 == $S4 -a $S1 != $S3 ];then
	echo Yes
elif [ $S1 == $S3 -a $S2 == $S4 -a $S1 != $S2 ];then
	echo Yes
elif [ $S1 == $S4 -a $S2 == $S3 -a $S1 != $S2 ];then
	echo Yes
else
	echo No
fi
