function Main(input) {
  var a = input.slice(0, 1);
  var b = input.slice(1, 2);
  var c = input.slice(2, 3);
  var d = input.slice(3, 4);
  
  if((a == b && c == d && a != c)
    || (a != b && a == c && b == d)
    || (a != b && b == c && a == d)){
     console.log("Yes");
     }else{
       console.log("No");
     }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
