import java.util.*;
public class Main{
  public static void main(String[] args) {
    Scanner sc=new Scanner(System.in);
    String s=sc.next();
    int count=0;
    int n=0;
    for(int i=1;i<4;i++){
      if(s.charAt(0)==s.charAt(i)){
        count=count+1;
        n=i;
      }
    }
    if(n==1){
      if(s.charAt(2)==s.charAt(3)){
        count=count+1;
      }
    }
    if(n==2){
      if(s.charAt(1)==s.charAt(3)){
        count=count+1;
      }
    }
    if(n==3){
      if(s.charAt(1)==s.charAt(2)){
        count=count+1;
      }
    }
    if(count==2){
      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();
    int count=0;
    int n=0;
    for(int i=1;i<4;i++){
      if(s.charAt(0)==s.charAt(i)){
        count=count+1;
        n=i;
      }
    }
    if(n==1){
      if(s.charAt(2)==s.charAt(3)){
        count=count+1;
      }
    }
    if(n==2){
      if(s.charAt(1)==s.charAt(3)){
        count=count+1;
      }
    }
    if(n==3){
      if(s.charAt(1)==s.charAt(2)){
        count=count+1;
      }
    }
    if(count==2){
      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();
    int count=0;
    int n=0;
    for(int i=1;i<4;i++){
      if(s.charAt(0)==s.charAt(i)){
        count=count+1;
        n=i;
      }
    }
    if(n==1){
      if(s.charAt(2)==s.charAt(3)){
        count=count+1;
      }
    }
    if(n==2){
      if(s.charAt(1)==s.charAt(3)){
        count=count+1;
      }
    }
    if(n==3){
      if(s.charAt(1)==s.charAt(2)){
        count=count+1;
      }
    }
    if(count==2){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  } main {
    Scanner sc=new Scanner(System.in);
    String s=sc.next();
    int count=0;
    int n=0;
    for(int i=1;i<4;i++){
      if(s.charAt(0)==s.charAt(i)){
        count=count+1;
        n=i;
      }
    }
    if(n==1){
      if(s.charAt(2)==s.charAt(3)){
        count=count+1;
      }
    }
    if(n==2){
      if(s.charAt(1)==s.charAt(3)){
        count=count+1;
      }
    }
    if(n==3){
      if(s.charAt(1)==s.charAt(2)){
        count=count+1;
      }
    }
    if(count==2){
      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 int count=0; count 0 int n=0; n 0 for(int i=1;i<4;i++){
      if(s.charAt(0)==s.charAt(i)){
        count=count+1;
        n=i;
      }
    } int i=1; int i=1; i 1 i<4 i 4 i++ i++ i {
      if(s.charAt(0)==s.charAt(i)){
        count=count+1;
        n=i;
      }
    } {
      if(s.charAt(0)==s.charAt(i)){
        count=count+1;
        n=i;
      }
    } if(s.charAt(0)==s.charAt(i)){
        count=count+1;
        n=i;
      } s.charAt(0)==s.charAt(i) s.charAt(0) s.charAt s 0 s.charAt(i) s.charAt s i {
        count=count+1;
        n=i;
      } count=count+1 count count+1 count 1 n=i n i if(n==1){
      if(s.charAt(2)==s.charAt(3)){
        count=count+1;
      }
    } n==1 n 1 {
      if(s.charAt(2)==s.charAt(3)){
        count=count+1;
      }
    } if(s.charAt(2)==s.charAt(3)){
        count=count+1;
      } s.charAt(2)==s.charAt(3) s.charAt(2) s.charAt s 2 s.charAt(3) s.charAt s 3 {
        count=count+1;
      } count=count+1 count count+1 count 1 if(n==2){
      if(s.charAt(1)==s.charAt(3)){
        count=count+1;
      }
    } n==2 n 2 {
      if(s.charAt(1)==s.charAt(3)){
        count=count+1;
      }
    } if(s.charAt(1)==s.charAt(3)){
        count=count+1;
      } s.charAt(1)==s.charAt(3) s.charAt(1) s.charAt s 1 s.charAt(3) s.charAt s 3 {
        count=count+1;
      } count=count+1 count count+1 count 1 if(n==3){
      if(s.charAt(1)==s.charAt(2)){
        count=count+1;
      }
    } n==3 n 3 {
      if(s.charAt(1)==s.charAt(2)){
        count=count+1;
      }
    } if(s.charAt(1)==s.charAt(2)){
        count=count+1;
      } s.charAt(1)==s.charAt(2) s.charAt(1) s.charAt s 1 s.charAt(2) s.charAt s 2 {
        count=count+1;
      } count=count+1 count count+1 count 1 if(count==2){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    } count==2 count 2 {
      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();
    int count=0;
    int n=0;
    for(int i=1;i<4;i++){
      if(s.charAt(0)==s.charAt(i)){
        count=count+1;
        n=i;
      }
    }
    if(n==1){
      if(s.charAt(2)==s.charAt(3)){
        count=count+1;
      }
    }
    if(n==2){
      if(s.charAt(1)==s.charAt(3)){
        count=count+1;
      }
    }
    if(n==3){
      if(s.charAt(1)==s.charAt(2)){
        count=count+1;
      }
    }
    if(count==2){
      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();
    int count=0;
    int n=0;
    for(int i=1;i<4;i++){
      if(s.charAt(0)==s.charAt(i)){
        count=count+1;
        n=i;
      }
    }
    if(n==1){
      if(s.charAt(2)==s.charAt(3)){
        count=count+1;
      }
    }
    if(n==2){
      if(s.charAt(1)==s.charAt(3)){
        count=count+1;
      }
    }
    if(n==3){
      if(s.charAt(1)==s.charAt(2)){
        count=count+1;
      }
    }
    if(count==2){
      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();
    int count=0;
    int n=0;
    for(int i=1;i<4;i++){
      if(s.charAt(0)==s.charAt(i)){
        count=count+1;
        n=i;
      }
    }
    if(n==1){
      if(s.charAt(2)==s.charAt(3)){
        count=count+1;
      }
    }
    if(n==2){
      if(s.charAt(1)==s.charAt(3)){
        count=count+1;
      }
    }
    if(n==3){
      if(s.charAt(1)==s.charAt(2)){
        count=count+1;
      }
    }
    if(count==2){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}
