function main(input) {
  input = input.trim();
  const a = input.split("");
 
  let b = Array.from(new Set(a));
  
  console.log((b.length)==2?'Yes':'No');
 
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));