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