import java.util.Scanner;

public class Main {
  public static void main (String[] args) {
    Scanner in = new Scanner(System.in);

    while (in.hasNext()) {
      String S = in.next();
      int[] count = new int[26];

      for (int i = 0; i < S.length(); ++i) {
        ++count[S.charAt(i) - 'A'];
      }
      
      int count2 = 0;
      for (int i = 0; i < count.length; ++i) {
        if (count[i] == 2) {
          ++count2;
        }
      }

      if (count2 == 2) {
        System.out.println("Yes");
      } else {
        System.out.println("No");
      }
    }
  }
} import java.util.Scanner; Scanner java.util public class Main {
  public static void main (String[] args) {
    Scanner in = new Scanner(System.in);

    while (in.hasNext()) {
      String S = in.next();
      int[] count = new int[26];

      for (int i = 0; i < S.length(); ++i) {
        ++count[S.charAt(i) - 'A'];
      }
      
      int count2 = 0;
      for (int i = 0; i < count.length; ++i) {
        if (count[i] == 2) {
          ++count2;
        }
      }

      if (count2 == 2) {
        System.out.println("Yes");
      } else {
        System.out.println("No");
      }
    }
  }
} Main public static void main (String[] args) {
    Scanner in = new Scanner(System.in);

    while (in.hasNext()) {
      String S = in.next();
      int[] count = new int[26];

      for (int i = 0; i < S.length(); ++i) {
        ++count[S.charAt(i) - 'A'];
      }
      
      int count2 = 0;
      for (int i = 0; i < count.length; ++i) {
        if (count[i] == 2) {
          ++count2;
        }
      }

      if (count2 == 2) {
        System.out.println("Yes");
      } else {
        System.out.println("No");
      }
    }
  } main {
    Scanner in = new Scanner(System.in);

    while (in.hasNext()) {
      String S = in.next();
      int[] count = new int[26];

      for (int i = 0; i < S.length(); ++i) {
        ++count[S.charAt(i) - 'A'];
      }
      
      int count2 = 0;
      for (int i = 0; i < count.length; ++i) {
        if (count[i] == 2) {
          ++count2;
        }
      }

      if (count2 == 2) {
        System.out.println("Yes");
      } else {
        System.out.println("No");
      }
    }
  } Scanner in = new Scanner(System.in); in new Scanner(System.in) while (in.hasNext()) {
      String S = in.next();
      int[] count = new int[26];

      for (int i = 0; i < S.length(); ++i) {
        ++count[S.charAt(i) - 'A'];
      }
      
      int count2 = 0;
      for (int i = 0; i < count.length; ++i) {
        if (count[i] == 2) {
          ++count2;
        }
      }

      if (count2 == 2) {
        System.out.println("Yes");
      } else {
        System.out.println("No");
      }
    } in.hasNext() in.hasNext in {
      String S = in.next();
      int[] count = new int[26];

      for (int i = 0; i < S.length(); ++i) {
        ++count[S.charAt(i) - 'A'];
      }
      
      int count2 = 0;
      for (int i = 0; i < count.length; ++i) {
        if (count[i] == 2) {
          ++count2;
        }
      }

      if (count2 == 2) {
        System.out.println("Yes");
      } else {
        System.out.println("No");
      }
    } String S = in.next(); S in.next() in.next in int[] count = new int[26]; count new int[26] 26 for (int i = 0; i < S.length(); ++i) {
        ++count[S.charAt(i) - 'A'];
      } int i = 0; int i = 0; i 0 i < S.length() i S.length() S.length S ++i ++i i {
        ++count[S.charAt(i) - 'A'];
      } {
        ++count[S.charAt(i) - 'A'];
      } ++count[S.charAt(i) - 'A'] count[S.charAt(i) - 'A'] count S.charAt(i) - 'A' S.charAt(i) S.charAt S i 'A' int count2 = 0; count2 0 for (int i = 0; i < count.length; ++i) {
        if (count[i] == 2) {
          ++count2;
        }
      } int i = 0; int i = 0; i 0 i < count.length i count.length count count.length ++i ++i i {
        if (count[i] == 2) {
          ++count2;
        }
      } {
        if (count[i] == 2) {
          ++count2;
        }
      } if (count[i] == 2) {
          ++count2;
        } count[i] == 2 count[i] count i 2 {
          ++count2;
        } ++count2 count2 if (count2 == 2) {
        System.out.println("Yes");
      } else {
        System.out.println("No");
      } count2 == 2 count2 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 in = new Scanner(System.in);

    while (in.hasNext()) {
      String S = in.next();
      int[] count = new int[26];

      for (int i = 0; i < S.length(); ++i) {
        ++count[S.charAt(i) - 'A'];
      }
      
      int count2 = 0;
      for (int i = 0; i < count.length; ++i) {
        if (count[i] == 2) {
          ++count2;
        }
      }

      if (count2 == 2) {
        System.out.println("Yes");
      } else {
        System.out.println("No");
      }
    }
  }
} public class Main {
  public static void main (String[] args) {
    Scanner in = new Scanner(System.in);

    while (in.hasNext()) {
      String S = in.next();
      int[] count = new int[26];

      for (int i = 0; i < S.length(); ++i) {
        ++count[S.charAt(i) - 'A'];
      }
      
      int count2 = 0;
      for (int i = 0; i < count.length; ++i) {
        if (count[i] == 2) {
          ++count2;
        }
      }

      if (count2 == 2) {
        System.out.println("Yes");
      } else {
        System.out.println("No");
      }
    }
  }
} Main
import java.util.Scanner;

public class Main {
  public static void main (String[] args) {
    Scanner in = new Scanner(System.in);

    while (in.hasNext()) {
      String S = in.next();
      int[] count = new int[26];

      for (int i = 0; i < S.length(); ++i) {
        ++count[S.charAt(i) - 'A'];
      }
      
      int count2 = 0;
      for (int i = 0; i < count.length; ++i) {
        if (count[i] == 2) {
          ++count2;
        }
      }

      if (count2 == 2) {
        System.out.println("Yes");
      } else {
        System.out.println("No");
      }
    }
  }
}