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

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.next();
        String[] strArray = str.split("");
        Map<String,Integer> map = new HashMap<>();
        for(String s: strArray){
            if(map.get(s) == null) map.put(s,1);
            else map.put(s,map.get(s)+1);
        }

        if(map.size() == 2) System.out.println("Yes");
        else System.out.println("No");
    }
} import java.util.HashMap; HashMap java.util import java.util.Map; Map java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.next();
        String[] strArray = str.split("");
        Map<String,Integer> map = new HashMap<>();
        for(String s: strArray){
            if(map.get(s) == null) map.put(s,1);
            else map.put(s,map.get(s)+1);
        }

        if(map.size() == 2) System.out.println("Yes");
        else System.out.println("No");
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.next();
        String[] strArray = str.split("");
        Map<String,Integer> map = new HashMap<>();
        for(String s: strArray){
            if(map.get(s) == null) map.put(s,1);
            else map.put(s,map.get(s)+1);
        }

        if(map.size() == 2) System.out.println("Yes");
        else System.out.println("No");
    } main {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.next();
        String[] strArray = str.split("");
        Map<String,Integer> map = new HashMap<>();
        for(String s: strArray){
            if(map.get(s) == null) map.put(s,1);
            else map.put(s,map.get(s)+1);
        }

        if(map.size() == 2) System.out.println("Yes");
        else System.out.println("No");
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String str = scanner.next(); str scanner.next() scanner.next scanner String[] strArray = str.split(""); strArray str.split("") str.split str "" Map<String,Integer> map = new HashMap<>(); map new HashMap<>() for(String s: strArray){
            if(map.get(s) == null) map.put(s,1);
            else map.put(s,map.get(s)+1);
        } String s strArray {
            if(map.get(s) == null) map.put(s,1);
            else map.put(s,map.get(s)+1);
        } {
            if(map.get(s) == null) map.put(s,1);
            else map.put(s,map.get(s)+1);
        } if(map.get(s) == null) map.put(s,1);
            else map.put(s,map.get(s)+1); map.get(s) == null map.get(s) map.get map s null map.put(s,1) map.put map s 1 map.put(s,map.get(s)+1) map.put map s map.get(s)+1 map.get(s) map.get map s 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 scanner = new Scanner(System.in);
        String str = scanner.next();
        String[] strArray = str.split("");
        Map<String,Integer> map = new HashMap<>();
        for(String s: strArray){
            if(map.get(s) == null) map.put(s,1);
            else map.put(s,map.get(s)+1);
        }

        if(map.size() == 2) System.out.println("Yes");
        else System.out.println("No");
    }
} public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.next();
        String[] strArray = str.split("");
        Map<String,Integer> map = new HashMap<>();
        for(String s: strArray){
            if(map.get(s) == null) map.put(s,1);
            else map.put(s,map.get(s)+1);
        }

        if(map.size() == 2) System.out.println("Yes");
        else System.out.println("No");
    }
} Main
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.next();
        String[] strArray = str.split("");
        Map<String,Integer> map = new HashMap<>();
        for(String s: strArray){
            if(map.get(s) == null) map.put(s,1);
            else map.put(s,map.get(s)+1);
        }

        if(map.size() == 2) System.out.println("Yes");
        else System.out.println("No");
    }
}
