'use strict';
function Main(input) {
  const stations = input.split("");
  const len = stations.length;
  if (3 < len) {
    console.log('No');
    return;
  }
  
  let hasBus = false;
  for (let i = 0; i < len; ++i) {
    for (let j = 0; j < len; ++j) {
      // 同一の駅
      if (i === j) {
        continue;
      }
      if ( stations[j] !== 'A' && stations[j] !== 'B' ) {
        hasBus = false;
        break;
      }
      hasBus = hasBus || stations[i] !== stations[j];
    }
  }
  console.log(hasBus ? 'Yes' : 'No');
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));