import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String str = sc.next();
		String ss[] = new String[4];
		sc.close();
		
		for(int i = 0; i < 4; i++) {
			ss[i] = str.substring(i , i + 1); 
		}
		
		String sa = str.replace(ss[0], "");
		if(sa.length() == 0) {
			System.out.println("No");
			return;
		}
		
		int target = 0;
		for(int i = 1; i < 4; i++) {
			if(ss[i].equals(ss[0])) {
				target = i;
				break;
			}
			if(i == 3) {
				System.out.println("No");
				return;
			}
		}
		
		if(target == 1){
		      if(ss[2].equals(ss[3])){
		        System.out.println("Yes");
		      }else{
		        System.out.println("No");
		      }
		    }else if(target == 2){
		      if(ss[1].equals(ss[3])){
		        System.out.println("Yes");
		      }else{
		        System.out.println("No");
		      }
		    }else{
		      if(ss[1].equals(ss[2])){
		        System.out.println("Yes");
		      }else{
		        System.out.println("No");
		      }
		 }
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String str = sc.next();
		String ss[] = new String[4];
		sc.close();
		
		for(int i = 0; i < 4; i++) {
			ss[i] = str.substring(i , i + 1); 
		}
		
		String sa = str.replace(ss[0], "");
		if(sa.length() == 0) {
			System.out.println("No");
			return;
		}
		
		int target = 0;
		for(int i = 1; i < 4; i++) {
			if(ss[i].equals(ss[0])) {
				target = i;
				break;
			}
			if(i == 3) {
				System.out.println("No");
				return;
			}
		}
		
		if(target == 1){
		      if(ss[2].equals(ss[3])){
		        System.out.println("Yes");
		      }else{
		        System.out.println("No");
		      }
		    }else if(target == 2){
		      if(ss[1].equals(ss[3])){
		        System.out.println("Yes");
		      }else{
		        System.out.println("No");
		      }
		    }else{
		      if(ss[1].equals(ss[2])){
		        System.out.println("Yes");
		      }else{
		        System.out.println("No");
		      }
		 }
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String str = sc.next();
		String ss[] = new String[4];
		sc.close();
		
		for(int i = 0; i < 4; i++) {
			ss[i] = str.substring(i , i + 1); 
		}
		
		String sa = str.replace(ss[0], "");
		if(sa.length() == 0) {
			System.out.println("No");
			return;
		}
		
		int target = 0;
		for(int i = 1; i < 4; i++) {
			if(ss[i].equals(ss[0])) {
				target = i;
				break;
			}
			if(i == 3) {
				System.out.println("No");
				return;
			}
		}
		
		if(target == 1){
		      if(ss[2].equals(ss[3])){
		        System.out.println("Yes");
		      }else{
		        System.out.println("No");
		      }
		    }else if(target == 2){
		      if(ss[1].equals(ss[3])){
		        System.out.println("Yes");
		      }else{
		        System.out.println("No");
		      }
		    }else{
		      if(ss[1].equals(ss[2])){
		        System.out.println("Yes");
		      }else{
		        System.out.println("No");
		      }
		 }
	} main {
		Scanner sc = new Scanner(System.in);
		
		String str = sc.next();
		String ss[] = new String[4];
		sc.close();
		
		for(int i = 0; i < 4; i++) {
			ss[i] = str.substring(i , i + 1); 
		}
		
		String sa = str.replace(ss[0], "");
		if(sa.length() == 0) {
			System.out.println("No");
			return;
		}
		
		int target = 0;
		for(int i = 1; i < 4; i++) {
			if(ss[i].equals(ss[0])) {
				target = i;
				break;
			}
			if(i == 3) {
				System.out.println("No");
				return;
			}
		}
		
		if(target == 1){
		      if(ss[2].equals(ss[3])){
		        System.out.println("Yes");
		      }else{
		        System.out.println("No");
		      }
		    }else if(target == 2){
		      if(ss[1].equals(ss[3])){
		        System.out.println("Yes");
		      }else{
		        System.out.println("No");
		      }
		    }else{
		      if(ss[1].equals(ss[2])){
		        System.out.println("Yes");
		      }else{
		        System.out.println("No");
		      }
		 }
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String str = sc.next(); str sc.next() sc.next sc String ss[] = new String[4]; ss new String[4] 4 sc.close() sc.close sc for(int i = 0; i < 4; i++) {
			ss[i] = str.substring(i , i + 1); 
		} int i = 0; int i = 0; i 0 i < 4 i 4 i++ i++ i {
			ss[i] = str.substring(i , i + 1); 
		} {
			ss[i] = str.substring(i , i + 1); 
		} ss[i] = str.substring(i , i + 1) ss[i] ss i str.substring(i , i + 1) str.substring str i i + 1 i 1 String sa = str.replace(ss[0], ""); sa str.replace(ss[0], "") str.replace str ss[0] ss 0 "" if(sa.length() == 0) {
			System.out.println("No");
			return;
		} sa.length() == 0 sa.length() sa.length sa 0 {
			System.out.println("No");
			return;
		} System.out.println("No") System.out.println System.out System System.out "No" return; int target = 0; target 0 for(int i = 1; i < 4; i++) {
			if(ss[i].equals(ss[0])) {
				target = i;
				break;
			}
			if(i == 3) {
				System.out.println("No");
				return;
			}
		} int i = 1; int i = 1; i 1 i < 4 i 4 i++ i++ i {
			if(ss[i].equals(ss[0])) {
				target = i;
				break;
			}
			if(i == 3) {
				System.out.println("No");
				return;
			}
		} {
			if(ss[i].equals(ss[0])) {
				target = i;
				break;
			}
			if(i == 3) {
				System.out.println("No");
				return;
			}
		} if(ss[i].equals(ss[0])) {
				target = i;
				break;
			} ss[i].equals(ss[0]) ss[i].equals ss[i] ss i ss[0] ss 0 {
				target = i;
				break;
			} target = i target i break; if(i == 3) {
				System.out.println("No");
				return;
			} i == 3 i 3 {
				System.out.println("No");
				return;
			} System.out.println("No") System.out.println System.out System System.out "No" return; if(target == 1){
		      if(ss[2].equals(ss[3])){
		        System.out.println("Yes");
		      }else{
		        System.out.println("No");
		      }
		    }else if(target == 2){
		      if(ss[1].equals(ss[3])){
		        System.out.println("Yes");
		      }else{
		        System.out.println("No");
		      }
		    }else{
		      if(ss[1].equals(ss[2])){
		        System.out.println("Yes");
		      }else{
		        System.out.println("No");
		      }
		 } target == 1 target 1 {
		      if(ss[2].equals(ss[3])){
		        System.out.println("Yes");
		      }else{
		        System.out.println("No");
		      }
		    } if(ss[2].equals(ss[3])){
		        System.out.println("Yes");
		      }else{
		        System.out.println("No");
		      } ss[2].equals(ss[3]) ss[2].equals ss[2] ss 2 ss[3] ss 3 {
		        System.out.println("Yes");
		      } System.out.println("Yes") System.out.println System.out System System.out "Yes" {
		        System.out.println("No");
		      } System.out.println("No") System.out.println System.out System System.out "No" if(target == 2){
		      if(ss[1].equals(ss[3])){
		        System.out.println("Yes");
		      }else{
		        System.out.println("No");
		      }
		    }else{
		      if(ss[1].equals(ss[2])){
		        System.out.println("Yes");
		      }else{
		        System.out.println("No");
		      }
		 } target == 2 target 2 {
		      if(ss[1].equals(ss[3])){
		        System.out.println("Yes");
		      }else{
		        System.out.println("No");
		      }
		    } if(ss[1].equals(ss[3])){
		        System.out.println("Yes");
		      }else{
		        System.out.println("No");
		      } ss[1].equals(ss[3]) ss[1].equals ss[1] ss 1 ss[3] ss 3 {
		        System.out.println("Yes");
		      } System.out.println("Yes") System.out.println System.out System System.out "Yes" {
		        System.out.println("No");
		      } System.out.println("No") System.out.println System.out System System.out "No" {
		      if(ss[1].equals(ss[2])){
		        System.out.println("Yes");
		      }else{
		        System.out.println("No");
		      }
		 } if(ss[1].equals(ss[2])){
		        System.out.println("Yes");
		      }else{
		        System.out.println("No");
		      } ss[1].equals(ss[2]) ss[1].equals ss[1] ss 1 ss[2] ss 2 {
		        System.out.println("Yes");
		      } System.out.println("Yes") System.out.println System.out System System.out "Yes" {
		        System.out.println("No");
		      } 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 sc = new Scanner(System.in);
		
		String str = sc.next();
		String ss[] = new String[4];
		sc.close();
		
		for(int i = 0; i < 4; i++) {
			ss[i] = str.substring(i , i + 1); 
		}
		
		String sa = str.replace(ss[0], "");
		if(sa.length() == 0) {
			System.out.println("No");
			return;
		}
		
		int target = 0;
		for(int i = 1; i < 4; i++) {
			if(ss[i].equals(ss[0])) {
				target = i;
				break;
			}
			if(i == 3) {
				System.out.println("No");
				return;
			}
		}
		
		if(target == 1){
		      if(ss[2].equals(ss[3])){
		        System.out.println("Yes");
		      }else{
		        System.out.println("No");
		      }
		    }else if(target == 2){
		      if(ss[1].equals(ss[3])){
		        System.out.println("Yes");
		      }else{
		        System.out.println("No");
		      }
		    }else{
		      if(ss[1].equals(ss[2])){
		        System.out.println("Yes");
		      }else{
		        System.out.println("No");
		      }
		 }
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String str = sc.next();
		String ss[] = new String[4];
		sc.close();
		
		for(int i = 0; i < 4; i++) {
			ss[i] = str.substring(i , i + 1); 
		}
		
		String sa = str.replace(ss[0], "");
		if(sa.length() == 0) {
			System.out.println("No");
			return;
		}
		
		int target = 0;
		for(int i = 1; i < 4; i++) {
			if(ss[i].equals(ss[0])) {
				target = i;
				break;
			}
			if(i == 3) {
				System.out.println("No");
				return;
			}
		}
		
		if(target == 1){
		      if(ss[2].equals(ss[3])){
		        System.out.println("Yes");
		      }else{
		        System.out.println("No");
		      }
		    }else if(target == 2){
		      if(ss[1].equals(ss[3])){
		        System.out.println("Yes");
		      }else{
		        System.out.println("No");
		      }
		    }else{
		      if(ss[1].equals(ss[2])){
		        System.out.println("Yes");
		      }else{
		        System.out.println("No");
		      }
		 }
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String str = sc.next();
		String ss[] = new String[4];
		sc.close();
		
		for(int i = 0; i < 4; i++) {
			ss[i] = str.substring(i , i + 1); 
		}
		
		String sa = str.replace(ss[0], "");
		if(sa.length() == 0) {
			System.out.println("No");
			return;
		}
		
		int target = 0;
		for(int i = 1; i < 4; i++) {
			if(ss[i].equals(ss[0])) {
				target = i;
				break;
			}
			if(i == 3) {
				System.out.println("No");
				return;
			}
		}
		
		if(target == 1){
		      if(ss[2].equals(ss[3])){
		        System.out.println("Yes");
		      }else{
		        System.out.println("No");
		      }
		    }else if(target == 2){
		      if(ss[1].equals(ss[3])){
		        System.out.println("Yes");
		      }else{
		        System.out.println("No");
		      }
		    }else{
		      if(ss[1].equals(ss[2])){
		        System.out.println("Yes");
		      }else{
		        System.out.println("No");
		      }
		 }
	}
}