import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        ArrayList<Character>  ary = new ArrayList<Character>();
        StringBuilder str = new StringBuilder(s);
        for(int i = 0; i < str.length(); ++i){
            ary.add(str.charAt(i));
        }
        Collections.sort(ary);
        if(ary.get(0) == ary.get(1) && ary.get(2) == ary.get(3) && ary.get(0) != ary.get(2)) {
            System.out.print("Yes");
        } else  {
            System.out.print("No");
        }
     }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        ArrayList<Character>  ary = new ArrayList<Character>();
        StringBuilder str = new StringBuilder(s);
        for(int i = 0; i < str.length(); ++i){
            ary.add(str.charAt(i));
        }
        Collections.sort(ary);
        if(ary.get(0) == ary.get(1) && ary.get(2) == ary.get(3) && ary.get(0) != ary.get(2)) {
            System.out.print("Yes");
        } else  {
            System.out.print("No");
        }
     }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        ArrayList<Character>  ary = new ArrayList<Character>();
        StringBuilder str = new StringBuilder(s);
        for(int i = 0; i < str.length(); ++i){
            ary.add(str.charAt(i));
        }
        Collections.sort(ary);
        if(ary.get(0) == ary.get(1) && ary.get(2) == ary.get(3) && ary.get(0) != ary.get(2)) {
            System.out.print("Yes");
        } else  {
            System.out.print("No");
        }
     } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        ArrayList<Character>  ary = new ArrayList<Character>();
        StringBuilder str = new StringBuilder(s);
        for(int i = 0; i < str.length(); ++i){
            ary.add(str.charAt(i));
        }
        Collections.sort(ary);
        if(ary.get(0) == ary.get(1) && ary.get(2) == ary.get(3) && ary.get(0) != ary.get(2)) {
            System.out.print("Yes");
        } else  {
            System.out.print("No");
        }
     } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc ArrayList<Character>  ary = new ArrayList<Character>(); ary new ArrayList<Character>() StringBuilder str = new StringBuilder(s); str new StringBuilder(s) for(int i = 0; i < str.length(); ++i){
            ary.add(str.charAt(i));
        } int i = 0; int i = 0; i 0 i < str.length() i str.length() str.length str ++i ++i i {
            ary.add(str.charAt(i));
        } {
            ary.add(str.charAt(i));
        } ary.add(str.charAt(i)) ary.add ary str.charAt(i) str.charAt str i Collections.sort(ary) Collections.sort Collections ary if(ary.get(0) == ary.get(1) && ary.get(2) == ary.get(3) && ary.get(0) != ary.get(2)) {
            System.out.print("Yes");
        } else  {
            System.out.print("No");
        } ary.get(0) == ary.get(1) && ary.get(2) == ary.get(3) && ary.get(0) != ary.get(2) ary.get(0) == ary.get(1) && ary.get(2) == ary.get(3) && ary.get(0) != ary.get(2) ary.get(0) == ary.get(1) ary.get(0) ary.get ary 0 ary.get(1) ary.get ary 1 ary.get(2) == ary.get(3) ary.get(2) ary.get ary 2 ary.get(3) ary.get ary 3 ary.get(0) != ary.get(2) ary.get(0) ary.get ary 0 ary.get(2) ary.get ary 2 {
            System.out.print("Yes");
        } System.out.print("Yes") System.out.print System.out System System.out "Yes" {
            System.out.print("No");
        } 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 s = sc.nextLine();
        ArrayList<Character>  ary = new ArrayList<Character>();
        StringBuilder str = new StringBuilder(s);
        for(int i = 0; i < str.length(); ++i){
            ary.add(str.charAt(i));
        }
        Collections.sort(ary);
        if(ary.get(0) == ary.get(1) && ary.get(2) == ary.get(3) && ary.get(0) != ary.get(2)) {
            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 s = sc.nextLine();
        ArrayList<Character>  ary = new ArrayList<Character>();
        StringBuilder str = new StringBuilder(s);
        for(int i = 0; i < str.length(); ++i){
            ary.add(str.charAt(i));
        }
        Collections.sort(ary);
        if(ary.get(0) == ary.get(1) && ary.get(2) == ary.get(3) && ary.get(0) != ary.get(2)) {
            System.out.print("Yes");
        } else  {
            System.out.print("No");
        }
     }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        ArrayList<Character>  ary = new ArrayList<Character>();
        StringBuilder str = new StringBuilder(s);
        for(int i = 0; i < str.length(); ++i){
            ary.add(str.charAt(i));
        }
        Collections.sort(ary);
        if(ary.get(0) == ary.get(1) && ary.get(2) == ary.get(3) && ary.get(0) != ary.get(2)) {
            System.out.print("Yes");
        } else  {
            System.out.print("No");
        }
     }
}