"use strict"

const main = lines => {

  const l = [...lines[0]]
  
  let k = {}
  for (const v of l) {
    k[v] = k[v] ? k[v] + 1 : 1
  }
  
  let r = 'Yes'
  for (const v in k) {
    if (k[v] !== 2) r = 'No'
  }
  
  console.log(r)

}
  
main(require('fs').readFileSync('/dev/stdin', 'utf8').split('\n'))