import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
    
		// 文字列の入力
       List<String> list = Arrays.asList(sc.next().split(""));
       Collections.sort(list);
    
		// 出力
		System.out.println(list.get(0).equals(list.get(1))
       && list.get(2).equals(list.get(3)) && !list.get(1).equals(list.get(2)) ? "Yes" : "No");
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
    
		// 文字列の入力
       List<String> list = Arrays.asList(sc.next().split(""));
       Collections.sort(list);
    
		// 出力
		System.out.println(list.get(0).equals(list.get(1))
       && list.get(2).equals(list.get(3)) && !list.get(1).equals(list.get(2)) ? "Yes" : "No");
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
    
		// 文字列の入力
       List<String> list = Arrays.asList(sc.next().split(""));
       Collections.sort(list);
    
		// 出力
		System.out.println(list.get(0).equals(list.get(1))
       && list.get(2).equals(list.get(3)) && !list.get(1).equals(list.get(2)) ? "Yes" : "No");
	} main {
		Scanner sc = new Scanner(System.in);
    
		// 文字列の入力
       List<String> list = Arrays.asList(sc.next().split(""));
       Collections.sort(list);
    
		// 出力
		System.out.println(list.get(0).equals(list.get(1))
       && list.get(2).equals(list.get(3)) && !list.get(1).equals(list.get(2)) ? "Yes" : "No");
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) List<String> list = Arrays.asList(sc.next().split("")); list Arrays.asList(sc.next().split("")) Arrays.asList Arrays sc.next().split("") sc.next().split sc.next() sc.next sc "" Collections.sort(list) Collections.sort Collections list System.out.println(list.get(0).equals(list.get(1))
       && list.get(2).equals(list.get(3)) && !list.get(1).equals(list.get(2)) ? "Yes" : "No") System.out.println System.out System System.out list.get(0).equals(list.get(1))
       && list.get(2).equals(list.get(3)) && !list.get(1).equals(list.get(2)) ? "Yes" : "No" list.get(0).equals(list.get(1))
       && list.get(2).equals(list.get(3)) && !list.get(1).equals(list.get(2)) list.get(0).equals(list.get(1))
       && list.get(2).equals(list.get(3)) && !list.get(1).equals(list.get(2)) list.get(0).equals(list.get(1)) list.get(0).equals list.get(0) list.get list 0 list.get(1) list.get list 1 list.get(2).equals(list.get(3)) list.get(2).equals list.get(2) list.get list 2 list.get(3) list.get list 3 !list.get(1).equals(list.get(2)) list.get(1).equals(list.get(2)) list.get(1).equals list.get(1) list.get list 1 list.get(2) list.get list 2 "Yes" "No" String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
    
		// 文字列の入力
       List<String> list = Arrays.asList(sc.next().split(""));
       Collections.sort(list);
    
		// 出力
		System.out.println(list.get(0).equals(list.get(1))
       && list.get(2).equals(list.get(3)) && !list.get(1).equals(list.get(2)) ? "Yes" : "No");
	}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
    
		// 文字列の入力
       List<String> list = Arrays.asList(sc.next().split(""));
       Collections.sort(list);
    
		// 出力
		System.out.println(list.get(0).equals(list.get(1))
       && list.get(2).equals(list.get(3)) && !list.get(1).equals(list.get(2)) ? "Yes" : "No");
	}
} Main
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
    
		// 文字列の入力
       List<String> list = Arrays.asList(sc.next().split(""));
       Collections.sort(list);
    
		// 出力
		System.out.println(list.get(0).equals(list.get(1))
       && list.get(2).equals(list.get(3)) && !list.get(1).equals(list.get(2)) ? "Yes" : "No");
	}
}