import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Main {

    public static void main(String[] args){
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String n = in.next();
        Map<Character, Integer> map = new HashMap<>();
        for (int i = 0; i < 4; i++){
            map.put(n.charAt(i), map.get(n.charAt(i)) == null ? 1: map.get(n.charAt(i))+1 );
        }
        if (map.size()== 2) System.out.println("Yes");
        else System.out.println("No");
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.*; util.* java public class Main {

    public static void main(String[] args){
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String n = in.next();
        Map<Character, Integer> map = new HashMap<>();
        for (int i = 0; i < 4; i++){
            map.put(n.charAt(i), map.get(n.charAt(i)) == null ? 1: map.get(n.charAt(i))+1 );
        }
        if (map.size()== 2) System.out.println("Yes");
        else System.out.println("No");
    }
} Main public static void main(String[] args){
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String n = in.next();
        Map<Character, Integer> map = new HashMap<>();
        for (int i = 0; i < 4; i++){
            map.put(n.charAt(i), map.get(n.charAt(i)) == null ? 1: map.get(n.charAt(i))+1 );
        }
        if (map.size()== 2) System.out.println("Yes");
        else System.out.println("No");
    } main {
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String n = in.next();
        Map<Character, Integer> map = new HashMap<>();
        for (int i = 0; i < 4; i++){
            map.put(n.charAt(i), map.get(n.charAt(i)) == null ? 1: map.get(n.charAt(i))+1 );
        }
        if (map.size()== 2) System.out.println("Yes");
        else System.out.println("No");
    } Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in))); in new Scanner(new BufferedReader(new InputStreamReader(System.in))) String n = in.next(); n in.next() in.next in Map<Character, Integer> map = new HashMap<>(); map new HashMap<>() for (int i = 0; i < 4; i++){
            map.put(n.charAt(i), map.get(n.charAt(i)) == null ? 1: map.get(n.charAt(i))+1 );
        } int i = 0; int i = 0; i 0 i < 4 i 4 i++ i++ i {
            map.put(n.charAt(i), map.get(n.charAt(i)) == null ? 1: map.get(n.charAt(i))+1 );
        } {
            map.put(n.charAt(i), map.get(n.charAt(i)) == null ? 1: map.get(n.charAt(i))+1 );
        } map.put(n.charAt(i), map.get(n.charAt(i)) == null ? 1: map.get(n.charAt(i))+1 ) map.put map n.charAt(i) n.charAt n i map.get(n.charAt(i)) == null ? 1: map.get(n.charAt(i))+1 map.get(n.charAt(i)) == null map.get(n.charAt(i)) map.get map n.charAt(i) n.charAt n i null 1 map.get(n.charAt(i))+1 map.get(n.charAt(i)) map.get map n.charAt(i) n.charAt n i 1 if (map.size()== 2) System.out.println("Yes");
        else System.out.println("No"); map.size()== 2 map.size() map.size map 2 System.out.println("Yes") System.out.println System.out System System.out "Yes" 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(new BufferedReader(new InputStreamReader(System.in)));
        String n = in.next();
        Map<Character, Integer> map = new HashMap<>();
        for (int i = 0; i < 4; i++){
            map.put(n.charAt(i), map.get(n.charAt(i)) == null ? 1: map.get(n.charAt(i))+1 );
        }
        if (map.size()== 2) System.out.println("Yes");
        else System.out.println("No");
    }
} public class Main {

    public static void main(String[] args){
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String n = in.next();
        Map<Character, Integer> map = new HashMap<>();
        for (int i = 0; i < 4; i++){
            map.put(n.charAt(i), map.get(n.charAt(i)) == null ? 1: map.get(n.charAt(i))+1 );
        }
        if (map.size()== 2) System.out.println("Yes");
        else System.out.println("No");
    }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Main {

    public static void main(String[] args){
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String n = in.next();
        Map<Character, Integer> map = new HashMap<>();
        for (int i = 0; i < 4; i++){
            map.put(n.charAt(i), map.get(n.charAt(i)) == null ? 1: map.get(n.charAt(i))+1 );
        }
        if (map.size()== 2) System.out.println("Yes");
        else System.out.println("No");
    }
}