import java.util.Arrays;
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String ans = "No";
    char[] c = new char[s.length()];

    for(int i=0; i<s.length(); ++i)
      c[i] = s.charAt(i);

    Arrays.sort(c);

    if(c[0] == c[1] && c[2] == c[3] && c[1] != c[2])
      ans = "Yes";

    System.out.println(ans);
  }
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String ans = "No";
    char[] c = new char[s.length()];

    for(int i=0; i<s.length(); ++i)
      c[i] = s.charAt(i);

    Arrays.sort(c);

    if(c[0] == c[1] && c[2] == c[3] && c[1] != c[2])
      ans = "Yes";

    System.out.println(ans);
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String ans = "No";
    char[] c = new char[s.length()];

    for(int i=0; i<s.length(); ++i)
      c[i] = s.charAt(i);

    Arrays.sort(c);

    if(c[0] == c[1] && c[2] == c[3] && c[1] != c[2])
      ans = "Yes";

    System.out.println(ans);
  } main {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String ans = "No";
    char[] c = new char[s.length()];

    for(int i=0; i<s.length(); ++i)
      c[i] = s.charAt(i);

    Arrays.sort(c);

    if(c[0] == c[1] && c[2] == c[3] && c[1] != c[2])
      ans = "Yes";

    System.out.println(ans);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String ans = "No"; ans "No" char[] c = new char[s.length()]; c new char[s.length()] s.length() s.length s for(int i=0; i<s.length(); ++i)
      c[i] = s.charAt(i); int i=0; int i=0; i 0 i<s.length() i s.length() s.length s ++i ++i i c[i] = s.charAt(i); c[i] = s.charAt(i) c[i] c i s.charAt(i) s.charAt s i Arrays.sort(c) Arrays.sort Arrays c if(c[0] == c[1] && c[2] == c[3] && c[1] != c[2])
      ans = "Yes"; c[0] == c[1] && c[2] == c[3] && c[1] != c[2] c[0] == c[1] && c[2] == c[3] && c[1] != 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[1] != c[2] c[1] c 1 c[2] c 2 ans = "Yes" ans "Yes" System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String ans = "No";
    char[] c = new char[s.length()];

    for(int i=0; i<s.length(); ++i)
      c[i] = s.charAt(i);

    Arrays.sort(c);

    if(c[0] == c[1] && c[2] == c[3] && c[1] != c[2])
      ans = "Yes";

    System.out.println(ans);
  }
} public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String ans = "No";
    char[] c = new char[s.length()];

    for(int i=0; i<s.length(); ++i)
      c[i] = s.charAt(i);

    Arrays.sort(c);

    if(c[0] == c[1] && c[2] == c[3] && c[1] != c[2])
      ans = "Yes";

    System.out.println(ans);
  }
} Main
import java.util.Arrays;
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String ans = "No";
    char[] c = new char[s.length()];

    for(int i=0; i<s.length(); ++i)
      c[i] = s.charAt(i);

    Arrays.sort(c);

    if(c[0] == c[1] && c[2] == c[3] && c[1] != c[2])
      ans = "Yes";

    System.out.println(ans);
  }
}