import java.util.*;

public class Main{
	public static void main(String args[]){
      Scanner scan = new Scanner(System.in);
      String string = scan.next();
      char[] c = new char[4];
      for(int i=0;i<4;i++){
        c[i] = string.charAt(i);
      }
      if(c[0]==c[3] && c[1]==c[2] && c[0]!=c[1]){
        System.out.println("Yes");
      }else if(c[0]==c[1] && c[2]==c[3] && c[0]!=c[2]){
        System.out.println("Yes");
      }else if(c[0]==c[2] && c[1]==c[3] && c[0]!=c[1]){
        System.out.println("Yes");
      }else{
        System.out.println("No");
      }
      
	}
} import java.util.*; util.* java public class Main{
	public static void main(String args[]){
      Scanner scan = new Scanner(System.in);
      String string = scan.next();
      char[] c = new char[4];
      for(int i=0;i<4;i++){
        c[i] = string.charAt(i);
      }
      if(c[0]==c[3] && c[1]==c[2] && c[0]!=c[1]){
        System.out.println("Yes");
      }else if(c[0]==c[1] && c[2]==c[3] && c[0]!=c[2]){
        System.out.println("Yes");
      }else if(c[0]==c[2] && c[1]==c[3] && c[0]!=c[1]){
        System.out.println("Yes");
      }else{
        System.out.println("No");
      }
      
	}
} Main public static void main(String args[]){
      Scanner scan = new Scanner(System.in);
      String string = scan.next();
      char[] c = new char[4];
      for(int i=0;i<4;i++){
        c[i] = string.charAt(i);
      }
      if(c[0]==c[3] && c[1]==c[2] && c[0]!=c[1]){
        System.out.println("Yes");
      }else if(c[0]==c[1] && c[2]==c[3] && c[0]!=c[2]){
        System.out.println("Yes");
      }else if(c[0]==c[2] && c[1]==c[3] && c[0]!=c[1]){
        System.out.println("Yes");
      }else{
        System.out.println("No");
      }
      
	} main {
      Scanner scan = new Scanner(System.in);
      String string = scan.next();
      char[] c = new char[4];
      for(int i=0;i<4;i++){
        c[i] = string.charAt(i);
      }
      if(c[0]==c[3] && c[1]==c[2] && c[0]!=c[1]){
        System.out.println("Yes");
      }else if(c[0]==c[1] && c[2]==c[3] && c[0]!=c[2]){
        System.out.println("Yes");
      }else if(c[0]==c[2] && c[1]==c[3] && c[0]!=c[1]){
        System.out.println("Yes");
      }else{
        System.out.println("No");
      }
      
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String string = scan.next(); string scan.next() scan.next scan char[] c = new char[4]; c new char[4] 4 for(int i=0;i<4;i++){
        c[i] = string.charAt(i);
      } int i=0; int i=0; i 0 i<4 i 4 i++ i++ i {
        c[i] = string.charAt(i);
      } {
        c[i] = string.charAt(i);
      } c[i] = string.charAt(i) c[i] c i string.charAt(i) string.charAt string i if(c[0]==c[3] && c[1]==c[2] && c[0]!=c[1]){
        System.out.println("Yes");
      }else if(c[0]==c[1] && c[2]==c[3] && c[0]!=c[2]){
        System.out.println("Yes");
      }else if(c[0]==c[2] && c[1]==c[3] && c[0]!=c[1]){
        System.out.println("Yes");
      }else{
        System.out.println("No");
      } c[0]==c[3] && c[1]==c[2] && c[0]!=c[1] c[0]==c[3] && c[1]==c[2] && c[0]!=c[1] c[0]==c[3] c[0] c 0 c[3] c 3 c[1]==c[2] c[1] c 1 c[2] c 2 c[0]!=c[1] c[0] c 0 c[1] c 1 {
        System.out.println("Yes");
      } System.out.println("Yes") System.out.println System.out System System.out "Yes" if(c[0]==c[1] && c[2]==c[3] && c[0]!=c[2]){
        System.out.println("Yes");
      }else if(c[0]==c[2] && c[1]==c[3] && c[0]!=c[1]){
        System.out.println("Yes");
      }else{
        System.out.println("No");
      } c[0]==c[1] && c[2]==c[3] && c[0]!=c[2] c[0]==c[1] && c[2]==c[3] && c[0]!=c[2] c[0]==c[1] c[0] c 0 c[1] c 1 c[2]==c[3] c[2] c 2 c[3] c 3 c[0]!=c[2] c[0] c 0 c[2] c 2 {
        System.out.println("Yes");
      } System.out.println("Yes") System.out.println System.out System System.out "Yes" if(c[0]==c[2] && c[1]==c[3] && c[0]!=c[1]){
        System.out.println("Yes");
      }else{
        System.out.println("No");
      } c[0]==c[2] && c[1]==c[3] && c[0]!=c[1] c[0]==c[2] && c[1]==c[3] && c[0]!=c[1] c[0]==c[2] c[0] c 0 c[2] c 2 c[1]==c[3] c[1] c 1 c[3] c 3 c[0]!=c[1] c[0] c 0 c[1] c 1 {
        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 scan = new Scanner(System.in);
      String string = scan.next();
      char[] c = new char[4];
      for(int i=0;i<4;i++){
        c[i] = string.charAt(i);
      }
      if(c[0]==c[3] && c[1]==c[2] && c[0]!=c[1]){
        System.out.println("Yes");
      }else if(c[0]==c[1] && c[2]==c[3] && c[0]!=c[2]){
        System.out.println("Yes");
      }else if(c[0]==c[2] && c[1]==c[3] && c[0]!=c[1]){
        System.out.println("Yes");
      }else{
        System.out.println("No");
      }
      
	}
} public class Main{
	public static void main(String args[]){
      Scanner scan = new Scanner(System.in);
      String string = scan.next();
      char[] c = new char[4];
      for(int i=0;i<4;i++){
        c[i] = string.charAt(i);
      }
      if(c[0]==c[3] && c[1]==c[2] && c[0]!=c[1]){
        System.out.println("Yes");
      }else if(c[0]==c[1] && c[2]==c[3] && c[0]!=c[2]){
        System.out.println("Yes");
      }else if(c[0]==c[2] && c[1]==c[3] && c[0]!=c[1]){
        System.out.println("Yes");
      }else{
        System.out.println("No");
      }
      
	}
} Main
import java.util.*;

public class Main{
	public static void main(String args[]){
      Scanner scan = new Scanner(System.in);
      String string = scan.next();
      char[] c = new char[4];
      for(int i=0;i<4;i++){
        c[i] = string.charAt(i);
      }
      if(c[0]==c[3] && c[1]==c[2] && c[0]!=c[1]){
        System.out.println("Yes");
      }else if(c[0]==c[1] && c[2]==c[3] && c[0]!=c[2]){
        System.out.println("Yes");
      }else if(c[0]==c[2] && c[1]==c[3] && c[0]!=c[1]){
        System.out.println("Yes");
      }else{
        System.out.println("No");
      }
      
	}
}
