def main ()

    stdin = gets.chomp.split("")
    if stdin.uniq().length == 2
        if stdin.count(stdin[0]) == 2
            print("Yes")
        else
            print("No")
        end
    else
        print("No")
    end

end

main()