import java.util.Map;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String str = sc.next();
    boolean ret = true;
    Map<Character, Integer> map = new HashMap<Character, Integer>();
    for (char c: str.toCharArray())
      if (map.containsKey(c))
        map.put(c, map.get(c) + 1);
      else
        map.put(c, 1);
    for (Map.Entry<Character, Integer> entry : map.entrySet()) {
      if (entry.getValue() != 2)
        ret = false;
    }
    if (ret)
      System.out.print("Yes");
    else
      System.out.print("No");
  }
} import java.util.Map; Map java.util import java.util.HashMap; HashMap java.util import java.util.Scanner; Scanner java.util public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String str = sc.next();
    boolean ret = true;
    Map<Character, Integer> map = new HashMap<Character, Integer>();
    for (char c: str.toCharArray())
      if (map.containsKey(c))
        map.put(c, map.get(c) + 1);
      else
        map.put(c, 1);
    for (Map.Entry<Character, Integer> entry : map.entrySet()) {
      if (entry.getValue() != 2)
        ret = false;
    }
    if (ret)
      System.out.print("Yes");
    else
      System.out.print("No");
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String str = sc.next();
    boolean ret = true;
    Map<Character, Integer> map = new HashMap<Character, Integer>();
    for (char c: str.toCharArray())
      if (map.containsKey(c))
        map.put(c, map.get(c) + 1);
      else
        map.put(c, 1);
    for (Map.Entry<Character, Integer> entry : map.entrySet()) {
      if (entry.getValue() != 2)
        ret = false;
    }
    if (ret)
      System.out.print("Yes");
    else
      System.out.print("No");
  } main {
    Scanner sc = new Scanner(System.in);
    String str = sc.next();
    boolean ret = true;
    Map<Character, Integer> map = new HashMap<Character, Integer>();
    for (char c: str.toCharArray())
      if (map.containsKey(c))
        map.put(c, map.get(c) + 1);
      else
        map.put(c, 1);
    for (Map.Entry<Character, Integer> entry : map.entrySet()) {
      if (entry.getValue() != 2)
        ret = false;
    }
    if (ret)
      System.out.print("Yes");
    else
      System.out.print("No");
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String str = sc.next(); str sc.next() sc.next sc boolean ret = true; ret true Map<Character, Integer> map = new HashMap<Character, Integer>(); map new HashMap<Character, Integer>() for (char c: str.toCharArray())
      if (map.containsKey(c))
        map.put(c, map.get(c) + 1);
      else
        map.put(c, 1); char c str.toCharArray() str.toCharArray str if (map.containsKey(c))
        map.put(c, map.get(c) + 1);
      else
        map.put(c, 1); if (map.containsKey(c))
        map.put(c, map.get(c) + 1);
      else
        map.put(c, 1); map.containsKey(c) map.containsKey map c map.put(c, map.get(c) + 1) map.put map c map.get(c) + 1 map.get(c) map.get map c 1 map.put(c, 1) map.put map c 1 for (Map.Entry<Character, Integer> entry : map.entrySet()) {
      if (entry.getValue() != 2)
        ret = false;
    } Map.Entry<Character, Integer> entry map.entrySet() map.entrySet map {
      if (entry.getValue() != 2)
        ret = false;
    } {
      if (entry.getValue() != 2)
        ret = false;
    } if (entry.getValue() != 2)
        ret = false; entry.getValue() != 2 entry.getValue() entry.getValue entry 2 ret = false ret false if (ret)
      System.out.print("Yes");
    else
      System.out.print("No"); ret System.out.print("Yes") System.out.print System.out System System.out "Yes" System.out.print("No") System.out.print 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 str = sc.next();
    boolean ret = true;
    Map<Character, Integer> map = new HashMap<Character, Integer>();
    for (char c: str.toCharArray())
      if (map.containsKey(c))
        map.put(c, map.get(c) + 1);
      else
        map.put(c, 1);
    for (Map.Entry<Character, Integer> entry : map.entrySet()) {
      if (entry.getValue() != 2)
        ret = false;
    }
    if (ret)
      System.out.print("Yes");
    else
      System.out.print("No");
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String str = sc.next();
    boolean ret = true;
    Map<Character, Integer> map = new HashMap<Character, Integer>();
    for (char c: str.toCharArray())
      if (map.containsKey(c))
        map.put(c, map.get(c) + 1);
      else
        map.put(c, 1);
    for (Map.Entry<Character, Integer> entry : map.entrySet()) {
      if (entry.getValue() != 2)
        ret = false;
    }
    if (ret)
      System.out.print("Yes");
    else
      System.out.print("No");
  }
} Main
import java.util.Map;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String str = sc.next();
    boolean ret = true;
    Map<Character, Integer> map = new HashMap<Character, Integer>();
    for (char c: str.toCharArray())
      if (map.containsKey(c))
        map.put(c, map.get(c) + 1);
      else
        map.put(c, 1);
    for (Map.Entry<Character, Integer> entry : map.entrySet()) {
      if (entry.getValue() != 2)
        ret = false;
    }
    if (ret)
      System.out.print("Yes");
    else
      System.out.print("No");
  }
}