'use strict';
function Main(input) {
  input = input.split("");
  
  var judge = true;
  var count = 0;
  for (var i = 0; i < input.length; i++){
  	var check = input[i];
    for (var j = 0; j < input.length; j++){
    	if (check === input[j]){
        	count += 1;
        }    
    }
    if(count > 2 && judge === true){ 
		judge = false
    }
    count = 0;
  }
  if(judge === true){
  	console.log('YES');
  }else{
  	console.log('NO');
  }  
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
