'use strict';
(function(input){
  input=input.trim().split('').sort();
  const ans=((input[0]!==input[1])?'No':
             (input[2]!==input[3])?'No':
             (input[0]===input[2])?'No':
             'Yes');
  console.log(ans);
})(require('fs').readFileSync('/dev/stdin','utf8'));