"use strict";
const main = arg => {
    let text = arg.split("");
  	let ans = "No";
  	// 全部同じだった時の処理
  	if(text.every(elm => { return elm == text[0]})){
    	ans = "No";
    } else if(
      (text[0] == text[1] && text[2] == text[3])
      ||
      (text[0] == text[2] && text[1] == text[3])
      ||
      (text[0] == text[3] && text[1] == text[2])
  	){
    	ans = "Yes";
    }
  	
  	console.log(ans);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
