import java.util.*;

class Main {
  public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int cnt = 0;
      int step = 0;
      String S = sc.next();
      String[] a = new String[4];
      int[] b = new int[4];
            
      for(int i=0; i<S.length(); i++) {
        if(i==0) {
        	a[0] = S.substring(i,i+1);
        	b[0] = b[0] + 1;
        } else {
        	if(S.substring(i,i+1).equals(a[0])) {
        		b[0] = b[0] + 1;
        	} 
        	else if (a[1]==null) {
        		a[1] = S.substring(i,i+1);
        		b[1] = 1;
        	}
        	else if (S.substring(i,i+1).equals(a[1])) {
        		b[1] = b[1] + 1;
        	}
        }
      }
      
      if(b[0]==2 && b[1]==2) {
    	  System.out.print("Yes");
      } else {
    	  System.out.print("No");
      }
  }  
} import java.util.*; util.* java class Main {
  public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int cnt = 0;
      int step = 0;
      String S = sc.next();
      String[] a = new String[4];
      int[] b = new int[4];
            
      for(int i=0; i<S.length(); i++) {
        if(i==0) {
        	a[0] = S.substring(i,i+1);
        	b[0] = b[0] + 1;
        } else {
        	if(S.substring(i,i+1).equals(a[0])) {
        		b[0] = b[0] + 1;
        	} 
        	else if (a[1]==null) {
        		a[1] = S.substring(i,i+1);
        		b[1] = 1;
        	}
        	else if (S.substring(i,i+1).equals(a[1])) {
        		b[1] = b[1] + 1;
        	}
        }
      }
      
      if(b[0]==2 && b[1]==2) {
    	  System.out.print("Yes");
      } else {
    	  System.out.print("No");
      }
  }  
} Main public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int cnt = 0;
      int step = 0;
      String S = sc.next();
      String[] a = new String[4];
      int[] b = new int[4];
            
      for(int i=0; i<S.length(); i++) {
        if(i==0) {
        	a[0] = S.substring(i,i+1);
        	b[0] = b[0] + 1;
        } else {
        	if(S.substring(i,i+1).equals(a[0])) {
        		b[0] = b[0] + 1;
        	} 
        	else if (a[1]==null) {
        		a[1] = S.substring(i,i+1);
        		b[1] = 1;
        	}
        	else if (S.substring(i,i+1).equals(a[1])) {
        		b[1] = b[1] + 1;
        	}
        }
      }
      
      if(b[0]==2 && b[1]==2) {
    	  System.out.print("Yes");
      } else {
    	  System.out.print("No");
      }
  } main {
      Scanner sc = new Scanner(System.in);
      int cnt = 0;
      int step = 0;
      String S = sc.next();
      String[] a = new String[4];
      int[] b = new int[4];
            
      for(int i=0; i<S.length(); i++) {
        if(i==0) {
        	a[0] = S.substring(i,i+1);
        	b[0] = b[0] + 1;
        } else {
        	if(S.substring(i,i+1).equals(a[0])) {
        		b[0] = b[0] + 1;
        	} 
        	else if (a[1]==null) {
        		a[1] = S.substring(i,i+1);
        		b[1] = 1;
        	}
        	else if (S.substring(i,i+1).equals(a[1])) {
        		b[1] = b[1] + 1;
        	}
        }
      }
      
      if(b[0]==2 && b[1]==2) {
    	  System.out.print("Yes");
      } else {
    	  System.out.print("No");
      }
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int cnt = 0; cnt 0 int step = 0; step 0 String S = sc.next(); S sc.next() sc.next sc String[] a = new String[4]; a new String[4] 4 int[] b = new int[4]; b new int[4] 4 for(int i=0; i<S.length(); i++) {
        if(i==0) {
        	a[0] = S.substring(i,i+1);
        	b[0] = b[0] + 1;
        } else {
        	if(S.substring(i,i+1).equals(a[0])) {
        		b[0] = b[0] + 1;
        	} 
        	else if (a[1]==null) {
        		a[1] = S.substring(i,i+1);
        		b[1] = 1;
        	}
        	else if (S.substring(i,i+1).equals(a[1])) {
        		b[1] = b[1] + 1;
        	}
        }
      } int i=0; int i=0; i 0 i<S.length() i S.length() S.length S i++ i++ i {
        if(i==0) {
        	a[0] = S.substring(i,i+1);
        	b[0] = b[0] + 1;
        } else {
        	if(S.substring(i,i+1).equals(a[0])) {
        		b[0] = b[0] + 1;
        	} 
        	else if (a[1]==null) {
        		a[1] = S.substring(i,i+1);
        		b[1] = 1;
        	}
        	else if (S.substring(i,i+1).equals(a[1])) {
        		b[1] = b[1] + 1;
        	}
        }
      } {
        if(i==0) {
        	a[0] = S.substring(i,i+1);
        	b[0] = b[0] + 1;
        } else {
        	if(S.substring(i,i+1).equals(a[0])) {
        		b[0] = b[0] + 1;
        	} 
        	else if (a[1]==null) {
        		a[1] = S.substring(i,i+1);
        		b[1] = 1;
        	}
        	else if (S.substring(i,i+1).equals(a[1])) {
        		b[1] = b[1] + 1;
        	}
        }
      } if(i==0) {
        	a[0] = S.substring(i,i+1);
        	b[0] = b[0] + 1;
        } else {
        	if(S.substring(i,i+1).equals(a[0])) {
        		b[0] = b[0] + 1;
        	} 
        	else if (a[1]==null) {
        		a[1] = S.substring(i,i+1);
        		b[1] = 1;
        	}
        	else if (S.substring(i,i+1).equals(a[1])) {
        		b[1] = b[1] + 1;
        	}
        } i==0 i 0 {
        	a[0] = S.substring(i,i+1);
        	b[0] = b[0] + 1;
        } a[0] = S.substring(i,i+1) a[0] a 0 S.substring(i,i+1) S.substring S i i+1 i 1 b[0] = b[0] + 1 b[0] b 0 b[0] + 1 b[0] b 0 1 {
        	if(S.substring(i,i+1).equals(a[0])) {
        		b[0] = b[0] + 1;
        	} 
        	else if (a[1]==null) {
        		a[1] = S.substring(i,i+1);
        		b[1] = 1;
        	}
        	else if (S.substring(i,i+1).equals(a[1])) {
        		b[1] = b[1] + 1;
        	}
        } if(S.substring(i,i+1).equals(a[0])) {
        		b[0] = b[0] + 1;
        	} 
        	else if (a[1]==null) {
        		a[1] = S.substring(i,i+1);
        		b[1] = 1;
        	}
        	else if (S.substring(i,i+1).equals(a[1])) {
        		b[1] = b[1] + 1;
        	} S.substring(i,i+1).equals(a[0]) S.substring(i,i+1).equals S.substring(i,i+1) S.substring S i i+1 i 1 a[0] a 0 {
        		b[0] = b[0] + 1;
        	} b[0] = b[0] + 1 b[0] b 0 b[0] + 1 b[0] b 0 1 if (a[1]==null) {
        		a[1] = S.substring(i,i+1);
        		b[1] = 1;
        	}
        	else if (S.substring(i,i+1).equals(a[1])) {
        		b[1] = b[1] + 1;
        	} a[1]==null a[1] a 1 null {
        		a[1] = S.substring(i,i+1);
        		b[1] = 1;
        	} a[1] = S.substring(i,i+1) a[1] a 1 S.substring(i,i+1) S.substring S i i+1 i 1 b[1] = 1 b[1] b 1 1 if (S.substring(i,i+1).equals(a[1])) {
        		b[1] = b[1] + 1;
        	} S.substring(i,i+1).equals(a[1]) S.substring(i,i+1).equals S.substring(i,i+1) S.substring S i i+1 i 1 a[1] a 1 {
        		b[1] = b[1] + 1;
        	} b[1] = b[1] + 1 b[1] b 1 b[1] + 1 b[1] b 1 1 if(b[0]==2 && b[1]==2) {
    	  System.out.print("Yes");
      } else {
    	  System.out.print("No");
      } b[0]==2 && b[1]==2 b[0]==2 b[0] b 0 2 b[1]==2 b[1] b 1 2 {
    	  System.out.print("Yes");
      } System.out.print("Yes") System.out.print System.out System System.out "Yes" {
    	  System.out.print("No");
      } System.out.print("No") System.out.print System.out System System.out "No" String[] args args
import java.util.*;

class Main {
  public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int cnt = 0;
      int step = 0;
      String S = sc.next();
      String[] a = new String[4];
      int[] b = new int[4];
            
      for(int i=0; i<S.length(); i++) {
        if(i==0) {
        	a[0] = S.substring(i,i+1);
        	b[0] = b[0] + 1;
        } else {
        	if(S.substring(i,i+1).equals(a[0])) {
        		b[0] = b[0] + 1;
        	} 
        	else if (a[1]==null) {
        		a[1] = S.substring(i,i+1);
        		b[1] = 1;
        	}
        	else if (S.substring(i,i+1).equals(a[1])) {
        		b[1] = b[1] + 1;
        	}
        }
      }
      
      if(b[0]==2 && b[1]==2) {
    	  System.out.print("Yes");
      } else {
    	  System.out.print("No");
      }
  }  
}