import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      String S = sc.next();
      String A = S.substring(0,1);
      String B = S.substring(1,2);
      String C = S.substring(2,3);
      String D = S.substring(3,4);
      if(A.equals(B) && B.equals(C) && C.equals(D)){
        System.out.println("No");
      }else if(A.equals(B)&&C.equals(D)||
               A.equals(C)&&B.equals(D)||
               A.equals(D)&&B.equals(C)){
        System.out.println("Yes");
      }else{
        System.out.println("No");
      }
    }
}      import java.util.*; util.* java public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      String S = sc.next();
      String A = S.substring(0,1);
      String B = S.substring(1,2);
      String C = S.substring(2,3);
      String D = S.substring(3,4);
      if(A.equals(B) && B.equals(C) && C.equals(D)){
        System.out.println("No");
      }else if(A.equals(B)&&C.equals(D)||
               A.equals(C)&&B.equals(D)||
               A.equals(D)&&B.equals(C)){
        System.out.println("Yes");
      }else{
        System.out.println("No");
      }
    }
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      String S = sc.next();
      String A = S.substring(0,1);
      String B = S.substring(1,2);
      String C = S.substring(2,3);
      String D = S.substring(3,4);
      if(A.equals(B) && B.equals(C) && C.equals(D)){
        System.out.println("No");
      }else if(A.equals(B)&&C.equals(D)||
               A.equals(C)&&B.equals(D)||
               A.equals(D)&&B.equals(C)){
        System.out.println("Yes");
      }else{
        System.out.println("No");
      }
    } main {
		Scanner sc = new Scanner(System.in);
      String S = sc.next();
      String A = S.substring(0,1);
      String B = S.substring(1,2);
      String C = S.substring(2,3);
      String D = S.substring(3,4);
      if(A.equals(B) && B.equals(C) && C.equals(D)){
        System.out.println("No");
      }else if(A.equals(B)&&C.equals(D)||
               A.equals(C)&&B.equals(D)||
               A.equals(D)&&B.equals(C)){
        System.out.println("Yes");
      }else{
        System.out.println("No");
      }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc String A = S.substring(0,1); A S.substring(0,1) S.substring S 0 1 String B = S.substring(1,2); B S.substring(1,2) S.substring S 1 2 String C = S.substring(2,3); C S.substring(2,3) S.substring S 2 3 String D = S.substring(3,4); D S.substring(3,4) S.substring S 3 4 if(A.equals(B) && B.equals(C) && C.equals(D)){
        System.out.println("No");
      }else if(A.equals(B)&&C.equals(D)||
               A.equals(C)&&B.equals(D)||
               A.equals(D)&&B.equals(C)){
        System.out.println("Yes");
      }else{
        System.out.println("No");
      } A.equals(B) && B.equals(C) && C.equals(D) A.equals(B) && B.equals(C) && C.equals(D) A.equals(B) A.equals A B B.equals(C) B.equals B C C.equals(D) C.equals C D {
        System.out.println("No");
      } System.out.println("No") System.out.println System.out System System.out "No" if(A.equals(B)&&C.equals(D)||
               A.equals(C)&&B.equals(D)||
               A.equals(D)&&B.equals(C)){
        System.out.println("Yes");
      }else{
        System.out.println("No");
      } A.equals(B)&&C.equals(D)||
               A.equals(C)&&B.equals(D)||
               A.equals(D)&&B.equals(C) A.equals(B)&&C.equals(D)||
               A.equals(C)&&B.equals(D)||
               A.equals(D)&&B.equals(C) A.equals(B)&&C.equals(D) A.equals(B) A.equals A B C.equals(D) C.equals C D A.equals(C)&&B.equals(D) A.equals(C) A.equals A C B.equals(D) B.equals B D A.equals(D)&&B.equals(C) A.equals(D) A.equals A D B.equals(C) B.equals B C {
        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 S = sc.next();
      String A = S.substring(0,1);
      String B = S.substring(1,2);
      String C = S.substring(2,3);
      String D = S.substring(3,4);
      if(A.equals(B) && B.equals(C) && C.equals(D)){
        System.out.println("No");
      }else if(A.equals(B)&&C.equals(D)||
               A.equals(C)&&B.equals(D)||
               A.equals(D)&&B.equals(C)){
        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 S = sc.next();
      String A = S.substring(0,1);
      String B = S.substring(1,2);
      String C = S.substring(2,3);
      String D = S.substring(3,4);
      if(A.equals(B) && B.equals(C) && C.equals(D)){
        System.out.println("No");
      }else if(A.equals(B)&&C.equals(D)||
               A.equals(C)&&B.equals(D)||
               A.equals(D)&&B.equals(C)){
        System.out.println("Yes");
      }else{
        System.out.println("No");
      }
    }
} Main
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      String S = sc.next();
      String A = S.substring(0,1);
      String B = S.substring(1,2);
      String C = S.substring(2,3);
      String D = S.substring(3,4);
      if(A.equals(B) && B.equals(C) && C.equals(D)){
        System.out.println("No");
      }else if(A.equals(B)&&C.equals(D)||
               A.equals(C)&&B.equals(D)||
               A.equals(D)&&B.equals(C)){
        System.out.println("Yes");
      }else{
        System.out.println("No");
      }
    }
}     