'use strict'

const main = (INPUT) => {
  const S = INPUT.split('\n')[0].split('')
  const ary = S.filter((x, i, self) => self.indexOf(x) === i)
  if (ary.length == 2) {
    console.log('Yes')
  } else {
    console.log('No')
  }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))
