import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String str = in.readLine();
    char[] c = str.toCharArray();
    Arrays.sort(c);
    System.out.println(c[0]==c[1] && c[1] != c[2] && c[2] == c[3] ?"Yes":"No");
  }
}
     import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.IOException; IOException java.io import java.util.Arrays; Arrays java.util public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String str = in.readLine();
    char[] c = str.toCharArray();
    Arrays.sort(c);
    System.out.println(c[0]==c[1] && c[1] != c[2] && c[2] == c[3] ?"Yes":"No");
  }
} Main public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String str = in.readLine();
    char[] c = str.toCharArray();
    Arrays.sort(c);
    System.out.println(c[0]==c[1] && c[1] != c[2] && c[2] == c[3] ?"Yes":"No");
  } main {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String str = in.readLine();
    char[] c = str.toCharArray();
    Arrays.sort(c);
    System.out.println(c[0]==c[1] && c[1] != c[2] && c[2] == c[3] ?"Yes":"No");
  } BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); in new BufferedReader(new InputStreamReader(System.in)) String str = in.readLine(); str in.readLine() in.readLine in char[] c = str.toCharArray(); c str.toCharArray() str.toCharArray str Arrays.sort(c) Arrays.sort Arrays c System.out.println(c[0]==c[1] && c[1] != c[2] && c[2] == c[3] ?"Yes":"No") System.out.println System.out System System.out c[0]==c[1] && c[1] != c[2] && c[2] == c[3] ?"Yes":"No" c[0]==c[1] && c[1] != c[2] && c[2] == c[3] c[0]==c[1] && c[1] != c[2] && c[2] == c[3] c[0]==c[1] c[0] c 0 c[1] c 1 c[1] != c[2] c[1] c 1 c[2] c 2 c[2] == c[3] c[2] c 2 c[3] c 3 "Yes" "No" String[] args args public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String str = in.readLine();
    char[] c = str.toCharArray();
    Arrays.sort(c);
    System.out.println(c[0]==c[1] && c[1] != c[2] && c[2] == c[3] ?"Yes":"No");
  }
} public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String str = in.readLine();
    char[] c = str.toCharArray();
    Arrays.sort(c);
    System.out.println(c[0]==c[1] && c[1] != c[2] && c[2] == c[3] ?"Yes":"No");
  }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String str = in.readLine();
    char[] c = str.toCharArray();
    Arrays.sort(c);
    System.out.println(c[0]==c[1] && c[1] != c[2] && c[2] == c[3] ?"Yes":"No");
  }
}
    