import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner scan = new Scanner(System.in);
        String testString = scan.next();
        Character one = testString.charAt(0);
        Character two = testString.charAt(1);
        Character three = testString.charAt(2);
        Character four = testString.charAt(3);
        if (one.equals(two) && three.equals(four) && !one.equals(three) && !one.equals(four)) {
            System.out.println("Yes");
        }
        else if (one.equals(three) && two.equals(four) && !one.equals(two) && !one.equals(four)) {
            System.out.println("Yes");
        }
        else if (one.equals(four) && two.equals(three) && !one.equals(two) && !one.equals(three)) {
            System.out.println("Yes");
        }
        else {
            System.out.println("No");
        }
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner scan = new Scanner(System.in);
        String testString = scan.next();
        Character one = testString.charAt(0);
        Character two = testString.charAt(1);
        Character three = testString.charAt(2);
        Character four = testString.charAt(3);
        if (one.equals(two) && three.equals(four) && !one.equals(three) && !one.equals(four)) {
            System.out.println("Yes");
        }
        else if (one.equals(three) && two.equals(four) && !one.equals(two) && !one.equals(four)) {
            System.out.println("Yes");
        }
        else if (one.equals(four) && two.equals(three) && !one.equals(two) && !one.equals(three)) {
            System.out.println("Yes");
        }
        else {
            System.out.println("No");
        }
    }
} Main public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner scan = new Scanner(System.in);
        String testString = scan.next();
        Character one = testString.charAt(0);
        Character two = testString.charAt(1);
        Character three = testString.charAt(2);
        Character four = testString.charAt(3);
        if (one.equals(two) && three.equals(four) && !one.equals(three) && !one.equals(four)) {
            System.out.println("Yes");
        }
        else if (one.equals(three) && two.equals(four) && !one.equals(two) && !one.equals(four)) {
            System.out.println("Yes");
        }
        else if (one.equals(four) && two.equals(three) && !one.equals(two) && !one.equals(three)) {
            System.out.println("Yes");
        }
        else {
            System.out.println("No");
        }
    } main {
        // Your code here!
        Scanner scan = new Scanner(System.in);
        String testString = scan.next();
        Character one = testString.charAt(0);
        Character two = testString.charAt(1);
        Character three = testString.charAt(2);
        Character four = testString.charAt(3);
        if (one.equals(two) && three.equals(four) && !one.equals(three) && !one.equals(four)) {
            System.out.println("Yes");
        }
        else if (one.equals(three) && two.equals(four) && !one.equals(two) && !one.equals(four)) {
            System.out.println("Yes");
        }
        else if (one.equals(four) && two.equals(three) && !one.equals(two) && !one.equals(three)) {
            System.out.println("Yes");
        }
        else {
            System.out.println("No");
        }
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String testString = scan.next(); testString scan.next() scan.next scan Character one = testString.charAt(0); one testString.charAt(0) testString.charAt testString 0 Character two = testString.charAt(1); two testString.charAt(1) testString.charAt testString 1 Character three = testString.charAt(2); three testString.charAt(2) testString.charAt testString 2 Character four = testString.charAt(3); four testString.charAt(3) testString.charAt testString 3 if (one.equals(two) && three.equals(four) && !one.equals(three) && !one.equals(four)) {
            System.out.println("Yes");
        }
        else if (one.equals(three) && two.equals(four) && !one.equals(two) && !one.equals(four)) {
            System.out.println("Yes");
        }
        else if (one.equals(four) && two.equals(three) && !one.equals(two) && !one.equals(three)) {
            System.out.println("Yes");
        }
        else {
            System.out.println("No");
        } one.equals(two) && three.equals(four) && !one.equals(three) && !one.equals(four) !one.equals(three) one.equals(two) && three.equals(four) && !one.equals(three) && !one.equals(four) one.equals(two) one.equals one two three.equals(four) three.equals three four !one.equals(three) one.equals(three) one.equals one three !one.equals(four) one.equals(four) one.equals one four {
            System.out.println("Yes");
        } System.out.println("Yes") System.out.println System.out System System.out "Yes" if (one.equals(three) && two.equals(four) && !one.equals(two) && !one.equals(four)) {
            System.out.println("Yes");
        }
        else if (one.equals(four) && two.equals(three) && !one.equals(two) && !one.equals(three)) {
            System.out.println("Yes");
        }
        else {
            System.out.println("No");
        } one.equals(three) && two.equals(four) && !one.equals(two) && !one.equals(four) !one.equals(two) one.equals(three) && two.equals(four) && !one.equals(two) && !one.equals(four) one.equals(three) one.equals one three two.equals(four) two.equals two four !one.equals(two) one.equals(two) one.equals one two !one.equals(four) one.equals(four) one.equals one four {
            System.out.println("Yes");
        } System.out.println("Yes") System.out.println System.out System System.out "Yes" if (one.equals(four) && two.equals(three) && !one.equals(two) && !one.equals(three)) {
            System.out.println("Yes");
        }
        else {
            System.out.println("No");
        } one.equals(four) && two.equals(three) && !one.equals(two) && !one.equals(three) !one.equals(two) one.equals(four) && two.equals(three) && !one.equals(two) && !one.equals(three) one.equals(four) one.equals one four two.equals(three) two.equals two three !one.equals(two) one.equals(two) one.equals one two !one.equals(three) one.equals(three) one.equals one three {
            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) throws Exception {
        // Your code here!
        Scanner scan = new Scanner(System.in);
        String testString = scan.next();
        Character one = testString.charAt(0);
        Character two = testString.charAt(1);
        Character three = testString.charAt(2);
        Character four = testString.charAt(3);
        if (one.equals(two) && three.equals(four) && !one.equals(three) && !one.equals(four)) {
            System.out.println("Yes");
        }
        else if (one.equals(three) && two.equals(four) && !one.equals(two) && !one.equals(four)) {
            System.out.println("Yes");
        }
        else if (one.equals(four) && two.equals(three) && !one.equals(two) && !one.equals(three)) {
            System.out.println("Yes");
        }
        else {
            System.out.println("No");
        }
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner scan = new Scanner(System.in);
        String testString = scan.next();
        Character one = testString.charAt(0);
        Character two = testString.charAt(1);
        Character three = testString.charAt(2);
        Character four = testString.charAt(3);
        if (one.equals(two) && three.equals(four) && !one.equals(three) && !one.equals(four)) {
            System.out.println("Yes");
        }
        else if (one.equals(three) && two.equals(four) && !one.equals(two) && !one.equals(four)) {
            System.out.println("Yes");
        }
        else if (one.equals(four) && two.equals(three) && !one.equals(two) && !one.equals(three)) {
            System.out.println("Yes");
        }
        else {
            System.out.println("No");
        }
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner scan = new Scanner(System.in);
        String testString = scan.next();
        Character one = testString.charAt(0);
        Character two = testString.charAt(1);
        Character three = testString.charAt(2);
        Character four = testString.charAt(3);
        if (one.equals(two) && three.equals(four) && !one.equals(three) && !one.equals(four)) {
            System.out.println("Yes");
        }
        else if (one.equals(three) && two.equals(four) && !one.equals(two) && !one.equals(four)) {
            System.out.println("Yes");
        }
        else if (one.equals(four) && two.equals(three) && !one.equals(two) && !one.equals(three)) {
            System.out.println("Yes");
        }
        else {
            System.out.println("No");
        }
    }
}
