import java.util.Scanner;
import java.util.Arrays;
import java.util.ArrayList;


public class Main{
  public static void main(String[] args){
  Scanner sc = new Scanner(System.in);
  int count = 0;
  int wcount = 0;
  //ArrayList<String> list = new ArrayList<String>();
  String[] array = new String[4];

  array = sc.next().split("");
  //for(int i=0; i<4; i++){
    //System.out.println(array[i]);
  //}
  ArrayList<String> list = new ArrayList<String>(Arrays.asList(array));

  for(int i=0; i<4; i++){
    for(int j=0;j<4; j++){
      if(array[i].equals(array[j])){
        count += 1;
        //System.out.println(count);
      }
    }
    if(count==2){
      wcount += 1;
    }
    count = 0;
  }
  //System.out.println(wcount);
  if(wcount == 4){
    System.out.println("Yes");
  }else{
    System.out.println("No");
  }

}
} import java.util.Scanner; Scanner java.util import java.util.Arrays; Arrays java.util import java.util.ArrayList; ArrayList java.util public class Main{
  public static void main(String[] args){
  Scanner sc = new Scanner(System.in);
  int count = 0;
  int wcount = 0;
  //ArrayList<String> list = new ArrayList<String>();
  String[] array = new String[4];

  array = sc.next().split("");
  //for(int i=0; i<4; i++){
    //System.out.println(array[i]);
  //}
  ArrayList<String> list = new ArrayList<String>(Arrays.asList(array));

  for(int i=0; i<4; i++){
    for(int j=0;j<4; j++){
      if(array[i].equals(array[j])){
        count += 1;
        //System.out.println(count);
      }
    }
    if(count==2){
      wcount += 1;
    }
    count = 0;
  }
  //System.out.println(wcount);
  if(wcount == 4){
    System.out.println("Yes");
  }else{
    System.out.println("No");
  }

}
} Main public static void main(String[] args){
  Scanner sc = new Scanner(System.in);
  int count = 0;
  int wcount = 0;
  //ArrayList<String> list = new ArrayList<String>();
  String[] array = new String[4];

  array = sc.next().split("");
  //for(int i=0; i<4; i++){
    //System.out.println(array[i]);
  //}
  ArrayList<String> list = new ArrayList<String>(Arrays.asList(array));

  for(int i=0; i<4; i++){
    for(int j=0;j<4; j++){
      if(array[i].equals(array[j])){
        count += 1;
        //System.out.println(count);
      }
    }
    if(count==2){
      wcount += 1;
    }
    count = 0;
  }
  //System.out.println(wcount);
  if(wcount == 4){
    System.out.println("Yes");
  }else{
    System.out.println("No");
  }

} main {
  Scanner sc = new Scanner(System.in);
  int count = 0;
  int wcount = 0;
  //ArrayList<String> list = new ArrayList<String>();
  String[] array = new String[4];

  array = sc.next().split("");
  //for(int i=0; i<4; i++){
    //System.out.println(array[i]);
  //}
  ArrayList<String> list = new ArrayList<String>(Arrays.asList(array));

  for(int i=0; i<4; i++){
    for(int j=0;j<4; j++){
      if(array[i].equals(array[j])){
        count += 1;
        //System.out.println(count);
      }
    }
    if(count==2){
      wcount += 1;
    }
    count = 0;
  }
  //System.out.println(wcount);
  if(wcount == 4){
    System.out.println("Yes");
  }else{
    System.out.println("No");
  }

} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int count = 0; count 0 int wcount = 0; wcount 0 String[] array = new String[4]; array new String[4] 4 array = sc.next().split("") array sc.next().split("") sc.next().split sc.next() sc.next sc "" ArrayList<String> list = new ArrayList<String>(Arrays.asList(array)); list new ArrayList<String>(Arrays.asList(array)) for(int i=0; i<4; i++){
    for(int j=0;j<4; j++){
      if(array[i].equals(array[j])){
        count += 1;
        //System.out.println(count);
      }
    }
    if(count==2){
      wcount += 1;
    }
    count = 0;
  } int i=0; int i=0; i 0 i<4 i 4 i++ i++ i {
    for(int j=0;j<4; j++){
      if(array[i].equals(array[j])){
        count += 1;
        //System.out.println(count);
      }
    }
    if(count==2){
      wcount += 1;
    }
    count = 0;
  } {
    for(int j=0;j<4; j++){
      if(array[i].equals(array[j])){
        count += 1;
        //System.out.println(count);
      }
    }
    if(count==2){
      wcount += 1;
    }
    count = 0;
  } for(int j=0;j<4; j++){
      if(array[i].equals(array[j])){
        count += 1;
        //System.out.println(count);
      }
    } int j=0; int j=0; j 0 j<4 j 4 j++ j++ j {
      if(array[i].equals(array[j])){
        count += 1;
        //System.out.println(count);
      }
    } {
      if(array[i].equals(array[j])){
        count += 1;
        //System.out.println(count);
      }
    } if(array[i].equals(array[j])){
        count += 1;
        //System.out.println(count);
      } array[i].equals(array[j]) array[i].equals array[i] array i array[j] array j {
        count += 1;
        //System.out.println(count);
      } count += 1 count 1 if(count==2){
      wcount += 1;
    } count==2 count 2 {
      wcount += 1;
    } wcount += 1 wcount 1 count = 0 count 0 if(wcount == 4){
    System.out.println("Yes");
  }else{
    System.out.println("No");
  } wcount == 4 wcount 4 {
    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);
  int count = 0;
  int wcount = 0;
  //ArrayList<String> list = new ArrayList<String>();
  String[] array = new String[4];

  array = sc.next().split("");
  //for(int i=0; i<4; i++){
    //System.out.println(array[i]);
  //}
  ArrayList<String> list = new ArrayList<String>(Arrays.asList(array));

  for(int i=0; i<4; i++){
    for(int j=0;j<4; j++){
      if(array[i].equals(array[j])){
        count += 1;
        //System.out.println(count);
      }
    }
    if(count==2){
      wcount += 1;
    }
    count = 0;
  }
  //System.out.println(wcount);
  if(wcount == 4){
    System.out.println("Yes");
  }else{
    System.out.println("No");
  }

}
} public class Main{
  public static void main(String[] args){
  Scanner sc = new Scanner(System.in);
  int count = 0;
  int wcount = 0;
  //ArrayList<String> list = new ArrayList<String>();
  String[] array = new String[4];

  array = sc.next().split("");
  //for(int i=0; i<4; i++){
    //System.out.println(array[i]);
  //}
  ArrayList<String> list = new ArrayList<String>(Arrays.asList(array));

  for(int i=0; i<4; i++){
    for(int j=0;j<4; j++){
      if(array[i].equals(array[j])){
        count += 1;
        //System.out.println(count);
      }
    }
    if(count==2){
      wcount += 1;
    }
    count = 0;
  }
  //System.out.println(wcount);
  if(wcount == 4){
    System.out.println("Yes");
  }else{
    System.out.println("No");
  }

}
} Main
import java.util.Scanner;
import java.util.Arrays;
import java.util.ArrayList;


public class Main{
  public static void main(String[] args){
  Scanner sc = new Scanner(System.in);
  int count = 0;
  int wcount = 0;
  //ArrayList<String> list = new ArrayList<String>();
  String[] array = new String[4];

  array = sc.next().split("");
  //for(int i=0; i<4; i++){
    //System.out.println(array[i]);
  //}
  ArrayList<String> list = new ArrayList<String>(Arrays.asList(array));

  for(int i=0; i<4; i++){
    for(int j=0;j<4; j++){
      if(array[i].equals(array[j])){
        count += 1;
        //System.out.println(count);
      }
    }
    if(count==2){
      wcount += 1;
    }
    count = 0;
  }
  //System.out.println(wcount);
  if(wcount == 4){
    System.out.println("Yes");
  }else{
    System.out.println("No");
  }

}
}