import java.util.Scanner;
import java.util.*;

public class Main {
        public static void main(String[] args) {
                Scanner scan = new Scanner(System.in);
                String h = scan.next();
    String[] ha = h.split("");
                
    Map<String, Integer> map = new HashMap<String, Integer>();
    map.put(ha[0], 1);
    int sum = 0;

    for(int i = 1; i < 4; i++){
      if(map.containsKey(ha[i])){
        map.put(ha[i], map.get(ha[i]) + 1);
      }else{
        map.put(ha[i], 1);
      }

      
    }

for(String key : map.keySet()){
 if(map.get(key) != 2){
    System.out.println("No");
   return;
 }
}

    System.out.println("Yes");
        }
} import java.util.Scanner; Scanner java.util import java.util.*; util.* java public class Main {
        public static void main(String[] args) {
                Scanner scan = new Scanner(System.in);
                String h = scan.next();
    String[] ha = h.split("");
                
    Map<String, Integer> map = new HashMap<String, Integer>();
    map.put(ha[0], 1);
    int sum = 0;

    for(int i = 1; i < 4; i++){
      if(map.containsKey(ha[i])){
        map.put(ha[i], map.get(ha[i]) + 1);
      }else{
        map.put(ha[i], 1);
      }

      
    }

for(String key : map.keySet()){
 if(map.get(key) != 2){
    System.out.println("No");
   return;
 }
}

    System.out.println("Yes");
        }
} Main public static void main(String[] args) {
                Scanner scan = new Scanner(System.in);
                String h = scan.next();
    String[] ha = h.split("");
                
    Map<String, Integer> map = new HashMap<String, Integer>();
    map.put(ha[0], 1);
    int sum = 0;

    for(int i = 1; i < 4; i++){
      if(map.containsKey(ha[i])){
        map.put(ha[i], map.get(ha[i]) + 1);
      }else{
        map.put(ha[i], 1);
      }

      
    }

for(String key : map.keySet()){
 if(map.get(key) != 2){
    System.out.println("No");
   return;
 }
}

    System.out.println("Yes");
        } main {
                Scanner scan = new Scanner(System.in);
                String h = scan.next();
    String[] ha = h.split("");
                
    Map<String, Integer> map = new HashMap<String, Integer>();
    map.put(ha[0], 1);
    int sum = 0;

    for(int i = 1; i < 4; i++){
      if(map.containsKey(ha[i])){
        map.put(ha[i], map.get(ha[i]) + 1);
      }else{
        map.put(ha[i], 1);
      }

      
    }

for(String key : map.keySet()){
 if(map.get(key) != 2){
    System.out.println("No");
   return;
 }
}

    System.out.println("Yes");
        } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String h = scan.next(); h scan.next() scan.next scan String[] ha = h.split(""); ha h.split("") h.split h "" Map<String, Integer> map = new HashMap<String, Integer>(); map new HashMap<String, Integer>() map.put(ha[0], 1) map.put map ha[0] ha 0 1 int sum = 0; sum 0 for(int i = 1; i < 4; i++){
      if(map.containsKey(ha[i])){
        map.put(ha[i], map.get(ha[i]) + 1);
      }else{
        map.put(ha[i], 1);
      }

      
    } int i = 1; int i = 1; i 1 i < 4 i 4 i++ i++ i {
      if(map.containsKey(ha[i])){
        map.put(ha[i], map.get(ha[i]) + 1);
      }else{
        map.put(ha[i], 1);
      }

      
    } {
      if(map.containsKey(ha[i])){
        map.put(ha[i], map.get(ha[i]) + 1);
      }else{
        map.put(ha[i], 1);
      }

      
    } if(map.containsKey(ha[i])){
        map.put(ha[i], map.get(ha[i]) + 1);
      }else{
        map.put(ha[i], 1);
      } map.containsKey(ha[i]) map.containsKey map ha[i] ha i {
        map.put(ha[i], map.get(ha[i]) + 1);
      } map.put(ha[i], map.get(ha[i]) + 1) map.put map ha[i] ha i map.get(ha[i]) + 1 map.get(ha[i]) map.get map ha[i] ha i 1 {
        map.put(ha[i], 1);
      } map.put(ha[i], 1) map.put map ha[i] ha i 1 for(String key : map.keySet()){
 if(map.get(key) != 2){
    System.out.println("No");
   return;
 }
} String key map.keySet() map.keySet map {
 if(map.get(key) != 2){
    System.out.println("No");
   return;
 }
} {
 if(map.get(key) != 2){
    System.out.println("No");
   return;
 }
} if(map.get(key) != 2){
    System.out.println("No");
   return;
 } map.get(key) != 2 map.get(key) map.get map key 2 {
    System.out.println("No");
   return;
 } System.out.println("No") System.out.println System.out System System.out "No" return; System.out.println("Yes") System.out.println System.out System System.out "Yes" String[] args args public class Main {
        public static void main(String[] args) {
                Scanner scan = new Scanner(System.in);
                String h = scan.next();
    String[] ha = h.split("");
                
    Map<String, Integer> map = new HashMap<String, Integer>();
    map.put(ha[0], 1);
    int sum = 0;

    for(int i = 1; i < 4; i++){
      if(map.containsKey(ha[i])){
        map.put(ha[i], map.get(ha[i]) + 1);
      }else{
        map.put(ha[i], 1);
      }

      
    }

for(String key : map.keySet()){
 if(map.get(key) != 2){
    System.out.println("No");
   return;
 }
}

    System.out.println("Yes");
        }
} public class Main {
        public static void main(String[] args) {
                Scanner scan = new Scanner(System.in);
                String h = scan.next();
    String[] ha = h.split("");
                
    Map<String, Integer> map = new HashMap<String, Integer>();
    map.put(ha[0], 1);
    int sum = 0;

    for(int i = 1; i < 4; i++){
      if(map.containsKey(ha[i])){
        map.put(ha[i], map.get(ha[i]) + 1);
      }else{
        map.put(ha[i], 1);
      }

      
    }

for(String key : map.keySet()){
 if(map.get(key) != 2){
    System.out.println("No");
   return;
 }
}

    System.out.println("Yes");
        }
} Main
import java.util.Scanner;
import java.util.*;

public class Main {
        public static void main(String[] args) {
                Scanner scan = new Scanner(System.in);
                String h = scan.next();
    String[] ha = h.split("");
                
    Map<String, Integer> map = new HashMap<String, Integer>();
    map.put(ha[0], 1);
    int sum = 0;

    for(int i = 1; i < 4; i++){
      if(map.containsKey(ha[i])){
        map.put(ha[i], map.get(ha[i]) + 1);
      }else{
        map.put(ha[i], 1);
      }

      
    }

for(String key : map.keySet()){
 if(map.get(key) != 2){
    System.out.println("No");
   return;
 }
}

    System.out.println("Yes");
        }
}