process.stdin.resume();
process.stdin.setEncoding('utf8');

var lines = [];
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on('line', (line) => {
  lines.push(line)
});

reader.on('close', () => {

  var s = {}
  var w = lines[0].split('')

  for (var val of w) {
    s[val] = 0
  }

  for (var val of w) {
    s[val] += 1
  }

  var r = 'Yes'

  for (var val of w) {
    if (s[val] !== 2) {
      r = 'No'
    }
  }

  console.log(r)

});