import java.util.*;
 
public class Main {
	public static void main (String[] args) {
		Scanner in = new Scanner(System.in);
		
		String s = in.next();
		char[] s_chars = s.toCharArray();
        Arrays.sort(s_chars);

      if(s_chars[0]==s_chars[1]&&s_chars[2]==s_chars[3]&&s_chars[0]!=s_chars[2]){
        System.out.print("Yes");
      }else{System.out.print("No");}
      
	}
} import java.util.*; util.* java public class Main {
	public static void main (String[] args) {
		Scanner in = new Scanner(System.in);
		
		String s = in.next();
		char[] s_chars = s.toCharArray();
        Arrays.sort(s_chars);

      if(s_chars[0]==s_chars[1]&&s_chars[2]==s_chars[3]&&s_chars[0]!=s_chars[2]){
        System.out.print("Yes");
      }else{System.out.print("No");}
      
	}
} Main public static void main (String[] args) {
		Scanner in = new Scanner(System.in);
		
		String s = in.next();
		char[] s_chars = s.toCharArray();
        Arrays.sort(s_chars);

      if(s_chars[0]==s_chars[1]&&s_chars[2]==s_chars[3]&&s_chars[0]!=s_chars[2]){
        System.out.print("Yes");
      }else{System.out.print("No");}
      
	} main {
		Scanner in = new Scanner(System.in);
		
		String s = in.next();
		char[] s_chars = s.toCharArray();
        Arrays.sort(s_chars);

      if(s_chars[0]==s_chars[1]&&s_chars[2]==s_chars[3]&&s_chars[0]!=s_chars[2]){
        System.out.print("Yes");
      }else{System.out.print("No");}
      
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) String s = in.next(); s in.next() in.next in char[] s_chars = s.toCharArray(); s_chars s.toCharArray() s.toCharArray s Arrays.sort(s_chars) Arrays.sort Arrays s_chars if(s_chars[0]==s_chars[1]&&s_chars[2]==s_chars[3]&&s_chars[0]!=s_chars[2]){
        System.out.print("Yes");
      }else{System.out.print("No");} s_chars[0]==s_chars[1]&&s_chars[2]==s_chars[3]&&s_chars[0]!=s_chars[2] s_chars[0]==s_chars[1]&&s_chars[2]==s_chars[3]&&s_chars[0]!=s_chars[2] s_chars[0]==s_chars[1] s_chars[0] s_chars 0 s_chars[1] s_chars 1 s_chars[2]==s_chars[3] s_chars[2] s_chars 2 s_chars[3] s_chars 3 s_chars[0]!=s_chars[2] s_chars[0] s_chars 0 s_chars[2] s_chars 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 public class Main {
	public static void main (String[] args) {
		Scanner in = new Scanner(System.in);
		
		String s = in.next();
		char[] s_chars = s.toCharArray();
        Arrays.sort(s_chars);

      if(s_chars[0]==s_chars[1]&&s_chars[2]==s_chars[3]&&s_chars[0]!=s_chars[2]){
        System.out.print("Yes");
      }else{System.out.print("No");}
      
	}
} public class Main {
	public static void main (String[] args) {
		Scanner in = new Scanner(System.in);
		
		String s = in.next();
		char[] s_chars = s.toCharArray();
        Arrays.sort(s_chars);

      if(s_chars[0]==s_chars[1]&&s_chars[2]==s_chars[3]&&s_chars[0]!=s_chars[2]){
        System.out.print("Yes");
      }else{System.out.print("No");}
      
	}
} Main
import java.util.*;
 
public class Main {
	public static void main (String[] args) {
		Scanner in = new Scanner(System.in);
		
		String s = in.next();
		char[] s_chars = s.toCharArray();
        Arrays.sort(s_chars);

      if(s_chars[0]==s_chars[1]&&s_chars[2]==s_chars[3]&&s_chars[0]!=s_chars[2]){
        System.out.print("Yes");
      }else{System.out.print("No");}
      
	}
}