import java.util.*;


public class Main {
    public static void main(String[] args) {
      
      Scanner sc = new Scanner(System.in);
      String s = sc.next();
      String a = "";
      String b = "";
      int ai = 0;
      int bi = 0;
      for (int i = 0; i < s.length(); i++) {
        if (a == "") {
          a = s.substring(i,i+1);
        } else if (a.equals(s.substring(i,i+1))) {
          ai += 1;
        } else if (b == "") {
          b = s.substring(i,i+1);
        } else if (b.equals(s.substring(i,i+1))) {
          bi += 1;
        }
      }
      if (ai == 1 && bi == 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 sc = new Scanner(System.in);
      String s = sc.next();
      String a = "";
      String b = "";
      int ai = 0;
      int bi = 0;
      for (int i = 0; i < s.length(); i++) {
        if (a == "") {
          a = s.substring(i,i+1);
        } else if (a.equals(s.substring(i,i+1))) {
          ai += 1;
        } else if (b == "") {
          b = s.substring(i,i+1);
        } else if (b.equals(s.substring(i,i+1))) {
          bi += 1;
        }
      }
      if (ai == 1 && bi == 1) {
        System.out.println("Yes");
      } else {
        System.out.println("No");
      }
    }
} Main public static void main(String[] args) {
      
      Scanner sc = new Scanner(System.in);
      String s = sc.next();
      String a = "";
      String b = "";
      int ai = 0;
      int bi = 0;
      for (int i = 0; i < s.length(); i++) {
        if (a == "") {
          a = s.substring(i,i+1);
        } else if (a.equals(s.substring(i,i+1))) {
          ai += 1;
        } else if (b == "") {
          b = s.substring(i,i+1);
        } else if (b.equals(s.substring(i,i+1))) {
          bi += 1;
        }
      }
      if (ai == 1 && bi == 1) {
        System.out.println("Yes");
      } else {
        System.out.println("No");
      }
    } main {
      
      Scanner sc = new Scanner(System.in);
      String s = sc.next();
      String a = "";
      String b = "";
      int ai = 0;
      int bi = 0;
      for (int i = 0; i < s.length(); i++) {
        if (a == "") {
          a = s.substring(i,i+1);
        } else if (a.equals(s.substring(i,i+1))) {
          ai += 1;
        } else if (b == "") {
          b = s.substring(i,i+1);
        } else if (b.equals(s.substring(i,i+1))) {
          bi += 1;
        }
      }
      if (ai == 1 && bi == 1) {
        System.out.println("Yes");
      } else {
        System.out.println("No");
      }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String a = ""; a "" String b = ""; b "" int ai = 0; ai 0 int bi = 0; bi 0 for (int i = 0; i < s.length(); i++) {
        if (a == "") {
          a = s.substring(i,i+1);
        } else if (a.equals(s.substring(i,i+1))) {
          ai += 1;
        } else if (b == "") {
          b = s.substring(i,i+1);
        } else if (b.equals(s.substring(i,i+1))) {
          bi += 1;
        }
      } int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
        if (a == "") {
          a = s.substring(i,i+1);
        } else if (a.equals(s.substring(i,i+1))) {
          ai += 1;
        } else if (b == "") {
          b = s.substring(i,i+1);
        } else if (b.equals(s.substring(i,i+1))) {
          bi += 1;
        }
      } {
        if (a == "") {
          a = s.substring(i,i+1);
        } else if (a.equals(s.substring(i,i+1))) {
          ai += 1;
        } else if (b == "") {
          b = s.substring(i,i+1);
        } else if (b.equals(s.substring(i,i+1))) {
          bi += 1;
        }
      } if (a == "") {
          a = s.substring(i,i+1);
        } else if (a.equals(s.substring(i,i+1))) {
          ai += 1;
        } else if (b == "") {
          b = s.substring(i,i+1);
        } else if (b.equals(s.substring(i,i+1))) {
          bi += 1;
        } a == "" a "" {
          a = s.substring(i,i+1);
        } a = s.substring(i,i+1) a s.substring(i,i+1) s.substring s i i+1 i 1 if (a.equals(s.substring(i,i+1))) {
          ai += 1;
        } else if (b == "") {
          b = s.substring(i,i+1);
        } else if (b.equals(s.substring(i,i+1))) {
          bi += 1;
        } a.equals(s.substring(i,i+1)) a.equals a s.substring(i,i+1) s.substring s i i+1 i 1 {
          ai += 1;
        } ai += 1 ai 1 if (b == "") {
          b = s.substring(i,i+1);
        } else if (b.equals(s.substring(i,i+1))) {
          bi += 1;
        } b == "" b "" {
          b = s.substring(i,i+1);
        } b = s.substring(i,i+1) b s.substring(i,i+1) s.substring s i i+1 i 1 if (b.equals(s.substring(i,i+1))) {
          bi += 1;
        } b.equals(s.substring(i,i+1)) b.equals b s.substring(i,i+1) s.substring s i i+1 i 1 {
          bi += 1;
        } bi += 1 bi 1 if (ai == 1 && bi == 1) {
        System.out.println("Yes");
      } else {
        System.out.println("No");
      } ai == 1 && bi == 1 ai == 1 ai 1 bi == 1 bi 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 sc = new Scanner(System.in);
      String s = sc.next();
      String a = "";
      String b = "";
      int ai = 0;
      int bi = 0;
      for (int i = 0; i < s.length(); i++) {
        if (a == "") {
          a = s.substring(i,i+1);
        } else if (a.equals(s.substring(i,i+1))) {
          ai += 1;
        } else if (b == "") {
          b = s.substring(i,i+1);
        } else if (b.equals(s.substring(i,i+1))) {
          bi += 1;
        }
      }
      if (ai == 1 && bi == 1) {
        System.out.println("Yes");
      } else {
        System.out.println("No");
      }
    }
} public class Main {
    public static void main(String[] args) {
      
      Scanner sc = new Scanner(System.in);
      String s = sc.next();
      String a = "";
      String b = "";
      int ai = 0;
      int bi = 0;
      for (int i = 0; i < s.length(); i++) {
        if (a == "") {
          a = s.substring(i,i+1);
        } else if (a.equals(s.substring(i,i+1))) {
          ai += 1;
        } else if (b == "") {
          b = s.substring(i,i+1);
        } else if (b.equals(s.substring(i,i+1))) {
          bi += 1;
        }
      }
      if (ai == 1 && bi == 1) {
        System.out.println("Yes");
      } else {
        System.out.println("No");
      }
    }
} Main
import java.util.*;


public class Main {
    public static void main(String[] args) {
      
      Scanner sc = new Scanner(System.in);
      String s = sc.next();
      String a = "";
      String b = "";
      int ai = 0;
      int bi = 0;
      for (int i = 0; i < s.length(); i++) {
        if (a == "") {
          a = s.substring(i,i+1);
        } else if (a.equals(s.substring(i,i+1))) {
          ai += 1;
        } else if (b == "") {
          b = s.substring(i,i+1);
        } else if (b.equals(s.substring(i,i+1))) {
          bi += 1;
        }
      }
      if (ai == 1 && bi == 1) {
        System.out.println("Yes");
      } else {
        System.out.println("No");
      }
    }
}