
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      String[] nyu=sc.nextLine().split("");
//     String nyu=sc.nextLine();

HashSet<String> list=new HashSet<>();

for(String temp:nyu)
list.add(temp);

if(list.size()!=2){
System.out.println("No");

}else{
int count=0;
for(int i=0;i<4;i++){
if(nyu[0].equals(nyu[i]))count++;
}

if(count==2){
System.out.println("Yes");

}else{
System.out.println("No");

}
}

//int num=Integer.parseInt(nyu);
//int numnext=Integer.parseInt(nyu[1]);
//int numend=Integer.parseInt(nyu[2]);

//System.out.println(numend);

//System.out.println(a/b);


	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      String[] nyu=sc.nextLine().split("");
//     String nyu=sc.nextLine();

HashSet<String> list=new HashSet<>();

for(String temp:nyu)
list.add(temp);

if(list.size()!=2){
System.out.println("No");

}else{
int count=0;
for(int i=0;i<4;i++){
if(nyu[0].equals(nyu[i]))count++;
}

if(count==2){
System.out.println("Yes");

}else{
System.out.println("No");

}
}

//int num=Integer.parseInt(nyu);
//int numnext=Integer.parseInt(nyu[1]);
//int numend=Integer.parseInt(nyu[2]);

//System.out.println(numend);

//System.out.println(a/b);


	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      String[] nyu=sc.nextLine().split("");
//     String nyu=sc.nextLine();

HashSet<String> list=new HashSet<>();

for(String temp:nyu)
list.add(temp);

if(list.size()!=2){
System.out.println("No");

}else{
int count=0;
for(int i=0;i<4;i++){
if(nyu[0].equals(nyu[i]))count++;
}

if(count==2){
System.out.println("Yes");

}else{
System.out.println("No");

}
}

//int num=Integer.parseInt(nyu);
//int numnext=Integer.parseInt(nyu[1]);
//int numend=Integer.parseInt(nyu[2]);

//System.out.println(numend);

//System.out.println(a/b);


	} main {
		Scanner sc = new Scanner(System.in);
      String[] nyu=sc.nextLine().split("");
//     String nyu=sc.nextLine();

HashSet<String> list=new HashSet<>();

for(String temp:nyu)
list.add(temp);

if(list.size()!=2){
System.out.println("No");

}else{
int count=0;
for(int i=0;i<4;i++){
if(nyu[0].equals(nyu[i]))count++;
}

if(count==2){
System.out.println("Yes");

}else{
System.out.println("No");

}
}

//int num=Integer.parseInt(nyu);
//int numnext=Integer.parseInt(nyu[1]);
//int numend=Integer.parseInt(nyu[2]);

//System.out.println(numend);

//System.out.println(a/b);


	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String[] nyu=sc.nextLine().split(""); nyu sc.nextLine().split("") sc.nextLine().split sc.nextLine() sc.nextLine sc "" HashSet<String> list=new HashSet<>(); list new HashSet<>() for(String temp:nyu)
list.add(temp); String temp nyu list.add(temp); list.add(temp) list.add list temp if(list.size()!=2){
System.out.println("No");

}else{
int count=0;
for(int i=0;i<4;i++){
if(nyu[0].equals(nyu[i]))count++;
}

if(count==2){
System.out.println("Yes");

}else{
System.out.println("No");

}
} list.size()!=2 list.size() list.size list 2 {
System.out.println("No");

} System.out.println("No") System.out.println System.out System System.out "No" {
int count=0;
for(int i=0;i<4;i++){
if(nyu[0].equals(nyu[i]))count++;
}

if(count==2){
System.out.println("Yes");

}else{
System.out.println("No");

}
} int count=0; count 0 for(int i=0;i<4;i++){
if(nyu[0].equals(nyu[i]))count++;
} int i=0; int i=0; i 0 i<4 i 4 i++ i++ i {
if(nyu[0].equals(nyu[i]))count++;
} {
if(nyu[0].equals(nyu[i]))count++;
} if(nyu[0].equals(nyu[i]))count++; nyu[0].equals(nyu[i]) nyu[0].equals nyu[0] nyu 0 nyu[i] nyu i count++ count if(count==2){
System.out.println("Yes");

}else{
System.out.println("No");

} count==2 count 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[] nyu=sc.nextLine().split("");
//     String nyu=sc.nextLine();

HashSet<String> list=new HashSet<>();

for(String temp:nyu)
list.add(temp);

if(list.size()!=2){
System.out.println("No");

}else{
int count=0;
for(int i=0;i<4;i++){
if(nyu[0].equals(nyu[i]))count++;
}

if(count==2){
System.out.println("Yes");

}else{
System.out.println("No");

}
}

//int num=Integer.parseInt(nyu);
//int numnext=Integer.parseInt(nyu[1]);
//int numend=Integer.parseInt(nyu[2]);

//System.out.println(numend);

//System.out.println(a/b);


	}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      String[] nyu=sc.nextLine().split("");
//     String nyu=sc.nextLine();

HashSet<String> list=new HashSet<>();

for(String temp:nyu)
list.add(temp);

if(list.size()!=2){
System.out.println("No");

}else{
int count=0;
for(int i=0;i<4;i++){
if(nyu[0].equals(nyu[i]))count++;
}

if(count==2){
System.out.println("Yes");

}else{
System.out.println("No");

}
}

//int num=Integer.parseInt(nyu);
//int numnext=Integer.parseInt(nyu[1]);
//int numend=Integer.parseInt(nyu[2]);

//System.out.println(numend);

//System.out.println(a/b);


	}
} Main

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      String[] nyu=sc.nextLine().split("");
//     String nyu=sc.nextLine();

HashSet<String> list=new HashSet<>();

for(String temp:nyu)
list.add(temp);

if(list.size()!=2){
System.out.println("No");

}else{
int count=0;
for(int i=0;i<4;i++){
if(nyu[0].equals(nyu[i]))count++;
}

if(count==2){
System.out.println("Yes");

}else{
System.out.println("No");

}
}

//int num=Integer.parseInt(nyu);
//int numnext=Integer.parseInt(nyu[1]);
//int numend=Integer.parseInt(nyu[2]);

//System.out.println(numend);

//System.out.println(a/b);


	}
}