import java.util.Scanner;
import java.util.LinkedHashSet;
import java.util.Set;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String[] arrayStr = sc.next().split("");

	    Set<String> linkedHashSet = new LinkedHashSet<String>();

	    for (int i = 0; i < arrayStr.length; i++) {
	    	
	    linkedHashSet.add(arrayStr[i]);
	    
	    }
	    
	    Object[] strings_after = linkedHashSet.toArray();
	    
	    if(strings_after.length == 2 ) {
	    	
	    	System.out.println("Yes");
	    	
	    } else {
	    	
	    	System.out.println("No");
	    }

	  }

} import java.util.Scanner; Scanner java.util import java.util.LinkedHashSet; LinkedHashSet java.util import java.util.Set; Set java.util public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String[] arrayStr = sc.next().split("");

	    Set<String> linkedHashSet = new LinkedHashSet<String>();

	    for (int i = 0; i < arrayStr.length; i++) {
	    	
	    linkedHashSet.add(arrayStr[i]);
	    
	    }
	    
	    Object[] strings_after = linkedHashSet.toArray();
	    
	    if(strings_after.length == 2 ) {
	    	
	    	System.out.println("Yes");
	    	
	    } else {
	    	
	    	System.out.println("No");
	    }

	  }

} Main public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String[] arrayStr = sc.next().split("");

	    Set<String> linkedHashSet = new LinkedHashSet<String>();

	    for (int i = 0; i < arrayStr.length; i++) {
	    	
	    linkedHashSet.add(arrayStr[i]);
	    
	    }
	    
	    Object[] strings_after = linkedHashSet.toArray();
	    
	    if(strings_after.length == 2 ) {
	    	
	    	System.out.println("Yes");
	    	
	    } else {
	    	
	    	System.out.println("No");
	    }

	  } main {

		Scanner sc = new Scanner(System.in);

		String[] arrayStr = sc.next().split("");

	    Set<String> linkedHashSet = new LinkedHashSet<String>();

	    for (int i = 0; i < arrayStr.length; i++) {
	    	
	    linkedHashSet.add(arrayStr[i]);
	    
	    }
	    
	    Object[] strings_after = linkedHashSet.toArray();
	    
	    if(strings_after.length == 2 ) {
	    	
	    	System.out.println("Yes");
	    	
	    } else {
	    	
	    	System.out.println("No");
	    }

	  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String[] arrayStr = sc.next().split(""); arrayStr sc.next().split("") sc.next().split sc.next() sc.next sc "" Set<String> linkedHashSet = new LinkedHashSet<String>(); linkedHashSet new LinkedHashSet<String>() for (int i = 0; i < arrayStr.length; i++) {
	    	
	    linkedHashSet.add(arrayStr[i]);
	    
	    } int i = 0; int i = 0; i 0 i < arrayStr.length i arrayStr.length arrayStr arrayStr.length i++ i++ i {
	    	
	    linkedHashSet.add(arrayStr[i]);
	    
	    } {
	    	
	    linkedHashSet.add(arrayStr[i]);
	    
	    } linkedHashSet.add(arrayStr[i]) linkedHashSet.add linkedHashSet arrayStr[i] arrayStr i Object[] strings_after = linkedHashSet.toArray(); strings_after linkedHashSet.toArray() linkedHashSet.toArray linkedHashSet if(strings_after.length == 2 ) {
	    	
	    	System.out.println("Yes");
	    	
	    } else {
	    	
	    	System.out.println("No");
	    } strings_after.length == 2 strings_after.length strings_after strings_after.length 2 {
	    	
	    	System.out.println("Yes");
	    	
	    } System.out.println("Yes") System.out.println System.out System System.out "Yes" {
	    	
	    	System.out.println("No");
	    } System.out.println("No") System.out.println System.out System System.out "No" String[] args args public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String[] arrayStr = sc.next().split("");

	    Set<String> linkedHashSet = new LinkedHashSet<String>();

	    for (int i = 0; i < arrayStr.length; i++) {
	    	
	    linkedHashSet.add(arrayStr[i]);
	    
	    }
	    
	    Object[] strings_after = linkedHashSet.toArray();
	    
	    if(strings_after.length == 2 ) {
	    	
	    	System.out.println("Yes");
	    	
	    } else {
	    	
	    	System.out.println("No");
	    }

	  }

} public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String[] arrayStr = sc.next().split("");

	    Set<String> linkedHashSet = new LinkedHashSet<String>();

	    for (int i = 0; i < arrayStr.length; i++) {
	    	
	    linkedHashSet.add(arrayStr[i]);
	    
	    }
	    
	    Object[] strings_after = linkedHashSet.toArray();
	    
	    if(strings_after.length == 2 ) {
	    	
	    	System.out.println("Yes");
	    	
	    } else {
	    	
	    	System.out.println("No");
	    }

	  }

} Main
import java.util.Scanner;
import java.util.LinkedHashSet;
import java.util.Set;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String[] arrayStr = sc.next().split("");

	    Set<String> linkedHashSet = new LinkedHashSet<String>();

	    for (int i = 0; i < arrayStr.length; i++) {
	    	
	    linkedHashSet.add(arrayStr[i]);
	    
	    }
	    
	    Object[] strings_after = linkedHashSet.toArray();
	    
	    if(strings_after.length == 2 ) {
	    	
	    	System.out.println("Yes");
	    	
	    } else {
	    	
	    	System.out.println("No");
	    }

	  }

}
