"use strict"
 
const main = lines => {
 
  const wordArr = [...lines[0]]
  
  let map = {}
  wordArr.forEach(w => {
   	map[w] = map[w] ? map[w] + 1 : 1
  })
  
  const result = Object.keys(map).map(key => map[key]).every(v => v === 2) ? "YES" : "NO"
  
  console.log(result)
 
}
  
main(require('fs').readFileSync('/dev/stdin', 'utf8').split('\n'))