function Main(input){
var S = input.split("");
var a = S.sort();
if(a[0]==a[2]){
  console.log("No");
}else{
 if(a[0]==a[1]&&a[2]==a[3]){
  console.log("Yes");
 }else{
   console.log("No");
 }
}
}
  Main(require('fs').readFileSync('/dev/stdin','utf8'));