



  

<!DOCTYPE html>
<html
  lang="en"
  
  data-color-mode="auto" data-light-theme="light" data-dark-theme="dark"
  data-a11y-animated-images="system" data-a11y-link-underlines="true"
  
  >




  <head>
    <meta charset="utf-8">
  <link rel="dns-prefetch" href="https://github.githubassets.com">
  <link rel="dns-prefetch" href="https://avatars.githubusercontent.com">
  <link rel="dns-prefetch" href="https://github-cloud.s3.amazonaws.com">
  <link rel="dns-prefetch" href="https://user-images.githubusercontent.com/">
  <link rel="preconnect" href="https://github.githubassets.com" crossorigin>
  <link rel="preconnect" href="https://avatars.githubusercontent.com">

<script type="importmap">{"imports":{"react":"https://github.githubassets.com/assets/react-e27d1b3e03961e68.js","react-dom":"https://github.githubassets.com/assets/react-dom-e5fd46a22d5c4058.js","react-dom/client":"https://github.githubassets.com/assets/react-dom-client-1b4a3ee065998cea.js","react-is":"https://github.githubassets.com/assets/react-is-e0b593954b4706d8.js","react-reconciler":"https://github.githubassets.com/assets/react-reconciler-8e99e505c4429605.js","react/compiler-runtime":"https://github.githubassets.com/assets/react-compiler-runtime-4610bd6d3de9c049.js","react/jsx-dev-runtime":"https://github.githubassets.com/assets/react-jsx-dev-runtime-ea55d68667d559e5.js","react/jsx-runtime":"https://github.githubassets.com/assets/react-jsx-runtime-4915cb0f5b3aff04.js","scheduler":"https://github.githubassets.com/assets/scheduler-58b860b049ca307c.js"}}</script>
<meta name="react-profiling" content="0" data-turbo-transient="true" />
<meta name="react-import-map" content="react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@777f63f87cd0" data-turbo-track="reload" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/react-e27d1b3e03961e68.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/react-compiler-runtime-4610bd6d3de9c049.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/scheduler-58b860b049ca307c.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/react-dom-e5fd46a22d5c4058.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/react-dom-client-1b4a3ee065998cea.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/react-is-e0b593954b4706d8.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/react-jsx-runtime-4915cb0f5b3aff04.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/react-reconciler-8e99e505c4429605.js" />

  


  <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/light-99f877e9ddfc0e51.css" /><link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/light_high_contrast-48fdd0811afbab3c.css" /><link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/dark-79ad2ace604703b3.css" /><link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/dark_high_contrast-24484a076f02295f.css" /><link data-color-theme="light" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light-99f877e9ddfc0e51.css" /><link data-color-theme="light_high_contrast" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_high_contrast-48fdd0811afbab3c.css" /><link data-color-theme="light_colorblind" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_colorblind-f4bf1142976e4bbf.css" /><link data-color-theme="light_colorblind_high_contrast" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_colorblind_high_contrast-f661b49995ba0bd8.css" /><link data-color-theme="light_tritanopia" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_tritanopia-0b38d22346321c92.css" /><link data-color-theme="light_tritanopia_high_contrast" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_tritanopia_high_contrast-f1c62c9e70259b9f.css" /><link data-color-theme="dark" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark-79ad2ace604703b3.css" /><link data-color-theme="dark_high_contrast" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_high_contrast-24484a076f02295f.css" /><link data-color-theme="dark_colorblind" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_colorblind-f50cacf0a86b9929.css" /><link data-color-theme="dark_colorblind_high_contrast" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_colorblind_high_contrast-e61d4f4ca17852c2.css" /><link data-color-theme="dark_tritanopia" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_tritanopia-39c10993d5603fac.css" /><link data-color-theme="dark_tritanopia_high_contrast" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_tritanopia_high_contrast-73236c840c0c7d90.css" /><link data-color-theme="dark_dimmed" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_dimmed-0de76f07cc035b10.css" /><link data-color-theme="dark_dimmed_high_contrast" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_dimmed_high_contrast-fd1500c8744e40d6.css" />

  <style type="text/css">
    :root {
      --tab-size-preference: 4;
    }

    pre, code {
      tab-size: var(--tab-size-preference);
    }
  </style>

    <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-primitives-ed9ca172356fd545.css" />
    <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-1d2c7f7b52a6068b.css" />
    <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/global-54ba76e934a49d7c.css" />
    <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/github-456bd5deb85c7ecd.css" />
  <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/repository-11ee8a031c040c1a.css" />
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/code-2d56bdb0166c0238.css" />

  

  <script type="application/json" id="client-env">{"locale":"en","featureFlags":["actions_enable_background_steps","actions_new_hosted_runner_image_select_sizes_and_versions","activity_diff_file_tree","activity_repos_file_tree","activity_repos_overview_header","activity_repos_overview_sidebar","agent_author_search_expansion","agent_author_search_expansion_ui_pulls","alternate_user_config_repo","async_conversion_coverage_enabled","billing_billable_licenses_cost_center_bucket_fix","billing_budget_expiration","billing_cost_center_list_assigned_resources","billing_discount_threshold_notification","code_quality_enablement_banner_targeting","code_quality_remove_preview","code_view_raf_sticky_lines","codespaces_prebuild_region_target_update","coding_agent_third_party_model_ui","copilot_agent_snippy","copilot_api_agentic_issue_marshal_yaml","copilot_automation_repo_mcp_servers","copilot_automations_pagination","copilot_chat_auto_mode_v2","copilot_chat_clear_model_selection_for_default_change","copilot_chat_header_reorder","copilot_chat_max_upsell","copilot_chat_models_browser_cache","copilot_chat_vision_dotcom_chat_ga_gate","copilot_css_textarea_autosize","copilot_custom_copilots","copilot_custom_copilots_feature_preview","copilot_duplicate_thread","copilot_extensions_removal_on_marketplace","copilot_fix_failed_workflows_all_skus","copilot_hide_hovercard","copilot_immersive_embedded_header_button","copilot_immersive_file_preview_keep_mounted","copilot_immersive_task_hyperlinking","copilot_mc_cli_resume_any_users_task","copilot_mission_control_agent_merge_fix_ci","copilot_mission_control_agent_merge_resolve_conflicts","copilot_mission_control_early_stop","copilot_mission_control_environment_list_icons","copilot_mission_control_managed_sandbox_environments","copilot_mission_control_needs_attention","copilot_mission_control_reasoning_effort","copilot_mission_control_sandbox_client_side_clone","copilot_mission_control_sandbox_remote_bypass","copilot_mission_control_session_filters","copilot_mission_control_task_alive_updates","copilot_mission_control_task_sharing","copilot_org_policy_page_focus_mode","copilot_share_active_subthread","copilot_spaces_ga","copilot_spaces_individual_policies_ga","copilot_spark_handle_nil_friendly_name","copilot_swe_agent_authorization_status_ui","copilot_swe_agent_automation_resource_scoped_writes","copilot_swe_agent_hide_model_picker_if_only_auto","copilot_swe_agent_issue_comment_trigger","copilot_swe_agent_pr_comment_model_picker","copilot_swe_agent_pull_request_comment_trigger","copilot_swe_agent_pull_request_merged_trigger","copilot_swe_agent_pull_request_opened_trigger","copilot_swe_agent_pull_request_synchronize_trigger","copilot_swe_agent_use_subagents","copilot_task_api_github_rest_style","copilot_task_scoped_alive_channel","copilot_token_based_billing","copilot_unconfigured_is_inherited","copilot_user_can_upgrade_plan_field","copilot_workbench_sunset","copilot_workbench_sunset_redirect","copilot_workbench_ubb","dashboard_indexeddb_caching","dashboard_lists_max_age_filter","dashboard_universe_2025_feedback_dialog","glc_code_quality_repo_settings_workflow_config","hide_github_models_ui","hyperspace_2025_logged_out_batch_1","hyperspace_2025_logged_out_batch_2","hyperspace_2025_logged_out_batch_3","in_product_messaging_datadog_monitoring","ipm_global_transactional_message_copilot","ipm_global_transactional_message_issues","ipm_global_transactional_message_prs","ipm_global_transactional_message_repos","ipm_global_transactional_message_spaces","ipm_ubb_individual_budget_banner","issue_fields_multi_select","issue_inline_avatars","issue_pinned_views","issue_pinned_views_optimistic_updates","issue_relative_time_micro","issues_dashboard_sso_structured_errors","issues_expanded_file_types","issues_hide_closed_sub_issues","issues_lazy_load_comment_box_suggestions","issues_optimistic_linked_branch_create","issues_react_chrome_container_query_fix","labels_archiving","labels_archiving_info","landing_pages_ninetailed","lifecycle_label_name_updates","marketing_cookie_consent_banner","marketing_pages_search_explore_provider","memex_client_env_github_domain","memex_default_issue_create_repository","memex_lazy_hydrate_agent_tasks","memex_live_update_hovercard","memex_mwl_filter_field_delimiter","memex_remove_deprecated_type_issue","merge_queue_restricted_pushers_warning","merge_status_checks_refetch_dedupe","merge_status_header_feedback","oauth_authorize_clickjacking_protection","octocaptcha_origin_optimization","primer_react_css_anchor_positioning","primer_react_merged_forwarded_refs","prs_copilot_app_open_action","prs_css_anchor_positioning","pull_request_commit_checks_dialog","pull_request_copilot_attribution_header","pull_request_overview_panel_edit_description","pull_request_persister","pull_request_stacks_feedback_dialog","pull_request_virtualization_image_estimate","pull_request_virtualization_scroll_compensation","pull_request_virtualization_scroll_intent","quick_search_lazy_suggestions","react_blob_isolate_code_lines","react_blob_ssr_content_visibility","react_data_router_tanstack_allowed","react_query_props_with_key","react_sandbox_future_tanstack","repo_app_turbo","repo_issues_sidebar_layout","repo_pulls_dashboard_persistence","repo_pulls_dashboard_sidebar_links","repos_contributors_limited_default_range","review_involves_filter","rule_ignored_file_paths","rulesets_actor_list_editor","sample_network_conn_type","security_center_artifact_filters_popover","see_who_reacted","semantic_similarity_duplicate_issue_detection","session_logs_ungroup_reasoning_text","set_sha256_on_repo_creation_form","site_banner_desktop_copilot_app","site_ghca_pixel_mona","site_github_app_ga_page","site_github_app_ga_page_highlight","site_github_app_mobile_native_share","site_global_banner_dev_days_attendee","site_global_banner_learn_copilot_sdk","site_global_nav_spark_models_removed","spark_prompt_secret_scanning","spark_server_connection_status","suggest_custom_property_values_copilot","suppress_automated_browser_vitals","swp_forms_disable_octocaptcha","thread_resolution_reason","ui_service_compute_proxy_control","ui_service_referrer_metrics","ui_service_staleness_detection","update_issue_suggestions","user_code_paste_ux","viewscreen_sandbox","warn_inaccessible_attachments","webp_support","workbench_store_readonly","workstream_plugin_bootstrap"],"githubDomain":"https://github.com","copilotApiOverrideUrl":"https://api.githubcopilot.com","cmcApiUrl":"https://api.github.com/cmc_internal/api"}</script>
<script crossorigin="anonymous" type="module" src="https://github.githubassets.com/assets/high-contrast-cookie-e3d808ee18eb9784.js"></script>
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/wp-runtime-89edc799b51753ef.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/app-foundation-74e9766bd696d26a.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/app-runtime-ecf766ea8a2c7fd6.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/fetch-utilities-8e3d9c5d57d50312.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/ser-cd1b421ad0ad7ed5.js" />
<script crossorigin="anonymous" type="module" src="https://github.githubassets.com/assets/environment-accd10af5f937cea.js" defer="defer"></script>
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/app-runtime.b6099d51b9e67b57.module.css" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/catalyst-86a8f5de995615f8.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/selector-observer-e88088f989b27670.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/relative-time-element-7cdf4e0db98b997c.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/by-6b3c07383371bf58.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/ja9-36f036c13c2e3a4c.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/kw-866fd9513ae95106.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/r1-b075aab3204f32f9.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/jz5-7c5d1669717041f8.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/hj-5126390ff433704d.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/j05-dce4d588268f0f7e.js" />
<script crossorigin="anonymous" type="module" src="https://github.githubassets.com/assets/github-elements-a202efd53fb4580b.js" defer="defer"></script>
<script crossorigin="anonymous" type="module" src="https://github.githubassets.com/assets/element-registry-f754e6647e89f5ed.js" defer="defer"></script>
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/runtime-helpers-f3f5d71440009c48.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/aria-live-76b18916d0c8ec4d.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/hotkey-5109c77d7ac61078.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/react-core-fbb00aaa3ab9abdf.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/04n-51c49ba758739f13.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/ur-024971cb63acad59.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/4t-364e19c63d726e9a.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/6ny-c969fbae697a356f.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/yhq-3a209035a30b1a09.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/z1v-da5b33b877bfa358.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/wo-09f85d22a6c8931b.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/9y-81cfe57dc9040f3e.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/j0-41a4cf04cbd99503.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/0p-81491ed0d9d666e2.js" />
<script crossorigin="anonymous" type="module" src="https://github.githubassets.com/assets/behaviors-d9c48a0e163e88ef.js" defer="defer"></script>
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/react-core.5858534b1c27f133.module.css" />
<script crossorigin="anonymous" type="module" src="https://github.githubassets.com/assets/code-menu-3b8ab478799e5d57.js" defer="defer"></script>
  
  <link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/primer-react-12ebdc24dcff1ecc.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/ncx-9a860680a5f230b9.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/j6-363f0ebf4f62f310.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/t7l-bf6f21d7e7a43c35.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/fe-7576d9b281e2106a.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/wsr-5fd3071e5a9061ab.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/0n-ecadb2ffe6b01ba2.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/xv-51cb34754bda73a9.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/n4u-6317ce1c31aed1db.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/j8s-d90ce3a169b741ed.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/la-de176c4ee471f2b3.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/eag-d9eea130fa716df9.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/y2-87df441f1bc5a264.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/kcz-607e36c8a3751cf0.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/x4-65dba777efd828f3.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/gzu-1a09248f686325f6.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/bi0-e2f78de823e39ca9.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/on-95be29ba1ef725d9.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/b1-1dbc371cef78c3c1.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/0l5-c4edb8ab48c5846d.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/c2z-c92998400310b94b.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/f9-038758dcbfe08dab.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/0k-b7df0a74912a42bf.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/sp-915c6643cc0d7d44.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/og-93ae8b358505d372.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/b9-69d9b60a1b1fcd59.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/ec-8ea7978d3fcd114e.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/du-a401e69a37d95bcc.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/ql0-1c18210f6b9e2263.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/20-0a2e46387735f1f4.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/dsj-cb1e4ddbce4f007b.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/wp-9f5235d335ab624b.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/ko6-9e80f7ac359e3c43.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/uw-8c275f7ac25b7cf6.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/bsb-4f4ac8c20da73fac.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/w5-13e3a7548bb20af9.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/fm-c00a7677663ba326.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/z-45022d3da7b8817e.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/h0-010921512138e12f.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/5p-ae5db0820116fb43.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/8vq-b2af216e992e11ef.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/g5-88f2a4514daa19ca.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/xc-f5d51b571cd317cb.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/arw-51e8918a1b75a80f.js" />
<script crossorigin="anonymous" type="module" src="https://github.githubassets.com/assets/code-view-7138cc1c3340b0a7.js" defer="defer"></script>
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-react-css.1ca6f67f06b8cb84.module.css" />
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/ql0.de7a55ca73db5693.module.css" />
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/z.812a998e1961b84d.module.css" />
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/xc.13e027137438fd9f.module.css" />
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/code-view.67917dc239e8d6b4.module.css" />

  <link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/hu-1fc0b2a167afc025.js" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/fb-ef2c91536abed646.js" />
<script crossorigin="anonymous" type="module" src="https://github.githubassets.com/assets/notifications-subscriptions-menu-7780a47593076cdc.js" defer="defer"></script>
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-react-css.1ca6f67f06b8cb84.module.css" />
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/notifications-subscriptions-menu.2d80f0a04efb0cc9.module.css" />


  <title>leetcode-master/problems/1047.删除字符串中的所有相邻重复项.md at master · feinan/leetcode-master · GitHub</title>



  <meta name="route-pattern" content="/:user_id/:repository/blob/*name(/*path)" data-turbo-transient>
  <meta name="route-controller" content="blob" data-turbo-transient>
  <meta name="route-action" content="show" data-turbo-transient>
  <meta name="fetch-nonce" content="v2:edbd6e29-97a1-a8fb-b252-487358c30773">

    
  <meta name="current-catalog-service-hash" content="f3abb0cc802f3d7b95fc8762b94bdcb13bf39634c40c357301c4aa1d67a256fb">


  <meta name="request-id" content="AD5C:165F5D:12D1300D:1195605B:6AACB4D3" data-pjax-transient="true"/><meta name="html-safe-nonce" content="67f6c0ab4152b9ba3ba9a68fd5ea49016a871ce68fa6e10a575add83e1a79cd3" data-pjax-transient="true"/><meta name="visitor-payload" content="eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRDVDOjE2NUY1RDoxMkQxMzAwRDoxMTk1NjA1Qjo2QUFDQjREMyIsInZpc2l0b3JfaWQiOiI3NDY2NzQxOTc2NjMyNDQwMDE5IiwicmVnaW9uX2VkZ2UiOiJmcmEiLCJyZWdpb25fcmVuZGVyIjoiZnJhIn0=" data-pjax-transient="true"/><meta name="visitor-hmac" content="712ff62ec76932cbb84fa3ce6c0cf555082b8d203967928e700c2410797e16ea" data-pjax-transient="true"/>


    <meta name="hovercard-subject-tag" content="repository:793905675" data-turbo-transient>


  <meta name="github-keyboard-shortcuts" content="repository,source-code,file-tree,copilot" data-turbo-transient="true" />
  

  <meta name="selected-link" value="repo_source" data-turbo-transient>
  <link rel="assets" href="https://github.githubassets.com/">

    <meta name="google-site-verification" content="Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I">

<meta name="octolytics-url" content="https://collector.github.com/github/collect" />





  <meta name="analytics-location" content="/&lt;user-name&gt;/&lt;repo-name&gt;/blob/show" data-turbo-transient="true" />

  




    <meta name="user-login" content="">

  

    <meta name="viewport" content="width=device-width">

    

      <meta name="description" content="《代码随想录》LeetCode 刷题攻略：200道经典题目刷题顺序，共60w字的详细图解，视频难点剖析，50余张思维导图，支持C++，Java，Python，Go，JavaScript等多语言版本，从此算法学习不再迷茫！🔥🔥 来看看，你会发现相见恨晚！🚀  - leetcode-master/problems/1047.删除字符串中的所有相邻重复项.md at master · feinan/leetcode-master">

      <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub">

    <link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub">
    <meta property="fb:app_id" content="1401488693436528">
    <meta name="apple-itunes-app" content="app-id=1477376905, app-argument=https://github.com/feinan/leetcode-master/blob/master/problems/1047.%E5%88%A0%E9%99%A4%E5%AD%97%E7%AC%A6%E4%B8%B2%E4%B8%AD%E7%9A%84%E6%89%80%E6%9C%89%E7%9B%B8%E9%82%BB%E9%87%8D%E5%A4%8D%E9%A1%B9.md" />

      <meta name="twitter:image" content="https://opengraph.githubassets.com/4bceb88f33f681892d82d046920e4eee0262c04b0d5eadd239c8051152eac176/feinan/leetcode-master" /><meta name="twitter:site" content="@github" /><meta name="twitter:card" content="summary_large_image" /><meta name="twitter:title" content="leetcode-master/problems/1047.删除字符串中的所有相邻重复项.md at master · feinan/leetcode-master" /><meta name="twitter:description" content="《代码随想录》LeetCode 刷题攻略：200道经典题目刷题顺序，共60w字的详细图解，视频难点剖析，50余张思维导图，支持C++，Java，Python，Go，JavaScript等多语言版本，从此算法学习不再迷茫！🔥🔥 来看看，你会发现相见恨晚！🚀  - feinan/leetcode-master" />
  <meta property="og:image" content="https://opengraph.githubassets.com/4bceb88f33f681892d82d046920e4eee0262c04b0d5eadd239c8051152eac176/feinan/leetcode-master" /><meta property="og:image:alt" content="《代码随想录》LeetCode 刷题攻略：200道经典题目刷题顺序，共60w字的详细图解，视频难点剖析，50余张思维导图，支持C++，Java，Python，Go，JavaScript等多语言版本，从此算法学习不再迷茫！🔥🔥 来看看，你会发现相见恨晚！🚀  - feinan/leetcode-master" /><meta property="og:image:width" content="1200" /><meta property="og:image:height" content="600" /><meta property="og:site_name" content="GitHub" /><meta property="og:type" content="object" /><meta property="og:title" content="leetcode-master/problems/1047.删除字符串中的所有相邻重复项.md at master · feinan/leetcode-master" /><meta property="og:url" content="https://github.com/feinan/leetcode-master/blob/master/problems/1047.%E5%88%A0%E9%99%A4%E5%AD%97%E7%AC%A6%E4%B8%B2%E4%B8%AD%E7%9A%84%E6%89%80%E6%9C%89%E7%9B%B8%E9%82%BB%E9%87%8D%E5%A4%8D%E9%A1%B9.md" /><meta property="og:description" content="《代码随想录》LeetCode 刷题攻略：200道经典题目刷题顺序，共60w字的详细图解，视频难点剖析，50余张思维导图，支持C++，Java，Python，Go，JavaScript等多语言版本，从此算法学习不再迷茫！🔥🔥 来看看，你会发现相见恨晚！🚀  - feinan/leetcode-master" />
  




      <meta name="hostname" content="github.com">



        <meta name="expected-hostname" content="github.com">


  <meta http-equiv="x-pjax-version" content="35883f2d6e224601624738e95ee86010a4b8e263b4001fc90c27f06700c1adb0" data-turbo-track="reload">
  <meta http-equiv="x-pjax-csp-version" content="0c5c6e5334a905d8f9521e09eadcffba484d422e0d262e07ff922e6bc18b2ac6" data-turbo-track="reload">
  <meta http-equiv="x-pjax-css-version" content="ec4c7b86d7b57240253150b827ea48b04e08d8760dc6553d2a04f62000f3fe0c" data-turbo-track="reload">
  <meta http-equiv="x-pjax-js-version" content="884e388b8bf8863200054089150bcb197604df0c29eca1338322e889e83b003e" data-turbo-track="reload">

  <meta name="turbo-cache-control" content="no-preview" data-turbo-transient="">

      <meta name="turbo-cache-control" content="no-cache" data-turbo-transient>

    <meta data-hydrostats="publish">

  <meta name="go-import" content="github.com/feinan/leetcode-master git https://github.com/feinan/leetcode-master.git">

  <meta name="octolytics-dimension-user_id" content="1912535" /><meta name="octolytics-dimension-user_login" content="feinan" /><meta name="octolytics-dimension-repository_id" content="793905675" /><meta name="octolytics-dimension-repository_nwo" content="feinan/leetcode-master" /><meta name="octolytics-dimension-repository_public" content="true" /><meta name="octolytics-dimension-repository_is_fork" content="true" /><meta name="octolytics-dimension-repository_parent_id" content="228016443" /><meta name="octolytics-dimension-repository_parent_nwo" content="youngyangyang04/leetcode-master" /><meta name="octolytics-dimension-repository_network_root_id" content="228016443" /><meta name="octolytics-dimension-repository_network_root_nwo" content="youngyangyang04/leetcode-master" />
  



    

    <meta name="turbo-body-classes" content="logged-out env-production page-responsive">
  <meta name="disable-turbo" content="false">


  <meta name="browser-stats-url" content="https://api.github.com/_private/browser/stats">


  <meta name="browser-errors-url" content="https://api.github.com/_private/browser/errors">

  <meta name="release" content="7bf9eee0b909297a76321e58ee721de675e8c391" data-turbo-track="reload">
  <meta name="ui-target" content="full">

  <link rel="mask-icon" href="https://github.githubassets.com/assets/pinned-octocat-093da3e6fa40.svg" color="#000000">
  <link rel="alternate icon" class="js-site-favicon" type="image/png" href="https://github.githubassets.com/favicons/favicon.png">
  <link rel="icon" class="js-site-favicon" type="image/svg+xml" href="https://github.githubassets.com/favicons/favicon.svg" data-base-href="https://github.githubassets.com/favicons/favicon">

<meta name="theme-color" content="#1e2327">
<meta name="color-scheme" content="light dark" />


  <link rel="manifest" href="/manifest.json" crossOrigin="use-credentials">

  </head>

  <body class="logged-out env-production page-responsive" style="word-wrap: break-word;" >
    <div data-turbo-body class="logged-out env-production page-responsive" style="word-wrap: break-word;" >
      <div id="__primerPortalRoot__" style="z-index: 1000; position: absolute; width: 100%;" data-turbo-permanent></div>
      

    <div class="position-relative header-wrapper js-header-wrapper ">
      <a href="#start-of-content" data-skip-target-assigned="false" class="px-2 tmp-py-4 color-bg-accent-emphasis color-fg-on-emphasis show-on-focus js-skip-to-content">Skip to content</a>

      <span data-view-component="true" class="progress-pjax-loader Progress position-fixed width-full">
    <span style="width: 0%;" data-view-component="true" class="Progress-item progress-pjax-loader-bar left-0 top-0 color-bg-accent-emphasis"></span>
</span>      
      <link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/l7j-2ddd8b435dadae28.js" fetchpriority="low" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/keyboard-shortcuts-dialog-ae53055c9bcf31bc.js" fetchpriority="low" />
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-react-css.1ca6f67f06b8cb84.module.css" />
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/keyboard-shortcuts-dialog.d65baa66881e2577.module.css" />

<react-partial
  partial-name="keyboard-shortcuts-dialog"
  data-ssr="false"
  data-attempted-ssr="false"
  data-react-profiling="false"
>
  
  <script type="application/json" data-target="react-partial.embeddedData">{"props":{"docsUrl":"https://docs.github.com/get-started/accessibility/keyboard-shortcuts"}}</script>
  <div data-target="react-partial.reactRoot"></div>
</react-partial>





      

          
          

                <link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/2l-8671acba87bc0dcb.js" fetchpriority="low" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/i26-f2ae65b837c90ae7.js" fetchpriority="low" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/fz5-23f28c0f388769c9.js" fetchpriority="low" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/lht-26506ea833dda5be.js" fetchpriority="low" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/p1-76a75a6081059b19.js" fetchpriority="low" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/3d-82c347d20a13fb90.js" fetchpriority="low" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/tua-c4ca62c5e0e0318e.js" fetchpriority="low" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/4s-c22d880230690e1f.js" fetchpriority="low" />
<link crossorigin="anonymous" rel="modulepreload" href="https://github.githubassets.com/assets/marketing-header-0bf3499489c9a91c.js" fetchpriority="low" />
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-react-css.1ca6f67f06b8cb84.module.css" />
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-react-brand-css.6a01c236ff527e7e.module.css" />
<link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/4s.e3d02f110161be52.module.css" />

<react-partial
  partial-name="marketing-header"
  data-ssr="true"
  data-attempted-ssr="true"
  data-react-profiling="false"
>
  
  <script type="application/json" data-target="react-partial.embeddedData">{"props":{"color_mode":"dark","logged_in":false,"marketing_page":false,"home_path":"/","login_path":"/login?return_to=https%3A%2F%2Fgithub.com%2Ffeinan%2Fleetcode-master%2Fblob%2Fmaster%2Fproblems%2F1047.%25E5%2588%25A0%25E9%2599%25A4%25E5%25AD%2597%25E7%25AC%25A6%25E4%25B8%25B2%25E4%25B8%25AD%25E7%259A%2584%25E6%2589%2580%25E6%259C%2589%25E7%259B%25B8%25E9%2582%25BB%25E9%2587%258D%25E5%25A4%258D%25E9%25A1%25B9.md","signup_path":"/signup?ref_cta=Sign+up\u0026ref_loc=header+logged+out\u0026ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fblob%2Fshow\u0026source=header-repo\u0026source_repo=feinan%2Fleetcode-master","signup_enabled":true,"is_signup_controller":false,"show_search_and_nav":true,"hide_search":false,"private_mode_enabled":false,"should_use_dotcom_links":true,"auth_hydro_click":"{\"event_type\":\"authentication.click\",\"payload\":{\"location_in_page\":\"site header menu\",\"repository_id\":null,\"auth_type\":\"SIGN_UP\",\"originating_url\":\"https://github.com/feinan/leetcode-master/blob/master/problems/1047.%E5%88%A0%E9%99%A4%E5%AD%97%E7%AC%A6%E4%B8%B2%E4%B8%AD%E7%9A%84%E6%89%80%E6%9C%89%E7%9B%B8%E9%82%BB%E9%87%8D%E5%A4%8D%E9%A1%B9.md\",\"user_id\":null}}","auth_hydro_click_hmac":"72aabcab98031ef0f02f070b427e560e754461ebe59feef6a26ab6282ff4bfc2","overlay":false,"fixed":false}}</script>
  <div data-target="react-partial.reactRoot"><div data-color-mode="dark" data-light-theme="light" data-dark-theme="dark"><header class="MarketingHeader-module__root__Tk7n3 HeaderMktg header-logged-out" role="banner" data-marketing-header="true" data-color-mode="dark" data-light-theme="light" data-dark-theme="dark" data-is-top="true"><h2 class="MarketingHeader-module__visuallyHidden__sqKsl">Navigation Menu</h2><button type="button" class="MarketingHeader-module__backdrop__sw4RU" aria-label="Close navigation menu"></button><div class="MarketingHeader-module__bar__mBSyE"><div class="MarketingHeader-module__topRow__yeury"><div class="MarketingHeader-module__toggleSlot__hDxbh"><button type="button" class="HeaderMenuToggle-module__toggle__i8EiC" aria-label="Toggle navigation" aria-expanded="false"><span class="HeaderMenuToggle-module__toggleBar__jVN0H"></span><span class="HeaderMenuToggle-module__toggleBar__jVN0H"></span><span class="HeaderMenuToggle-module__toggleBar__jVN0H"></span></button></div><a href="/" aria-label="Homepage" class="HeaderLogo-module__logo__UFyHI" data-analytics-event="{&quot;action&quot;:&quot;homepage&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;logo&quot;,&quot;location&quot;:&quot;header&quot;,&quot;label&quot;:&quot;homepage_link_logo_header&quot;}"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-mark-github" viewBox="0 0 24 24" width="32" height="32" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M10.226 17.284c-2.965-.36-5.054-2.493-5.054-5.256 0-1.123.404-2.336 1.078-3.144-.292-.741-.247-2.314.09-2.965.898-.112 2.111.36 2.83 1.01.853-.269 1.752-.404 2.853-.404 1.1 0 1.999.135 2.807.382.696-.629 1.932-1.1 2.83-.988.315.606.36 2.179.067 2.942.72.854 1.101 2 1.101 3.167 0 2.763-2.089 4.852-5.098 5.234.763.494 1.28 1.572 1.28 2.807v2.336c0 .674.561 1.056 1.235.786 4.066-1.55 7.255-5.615 7.255-10.646C23.5 6.188 18.334 1 11.978 1 5.62 1 .5 6.188.5 12.545c0 4.986 3.167 9.12 7.435 10.669.606.225 1.19-.18 1.19-.786V20.63a2.9 2.9 0 0 1-1.078.224c-1.483 0-2.359-.808-2.987-2.313-.247-.607-.517-.966-1.034-1.033-.27-.023-.359-.135-.359-.27 0-.27.45-.471.898-.471.652 0 1.213.404 1.797 1.235.45.651.921.943 1.483.943.561 0 .92-.202 1.437-.719.382-.381.674-.718.944-.943"></path></svg></a><div class="AuthCTAs-module__mobileActions__NNzeV"><a class="Primer_Brand__Button-module__Button___scH9Z Primer_Brand__Button-module__Button--subtle___F7pEE Primer_Brand__Button-module__Button--size-small___zQrEw AuthCTAs-module__cta__WpwQq" href="/login?return_to=https%3A%2F%2Fgithub.com%2Ffeinan%2Fleetcode-master%2Fblob%2Fmaster%2Fproblems%2F1047.%25E5%2588%25A0%25E9%2599%25A4%25E5%25AD%2597%25E7%25AC%25A6%25E4%25B8%25B2%25E4%25B8%25AD%25E7%259A%2584%25E6%2589%2580%25E6%259C%2589%25E7%259B%25B8%25E9%2582%25BB%25E9%2587%258D%25E5%25A4%258D%25E9%25A1%25B9.md" data-analytics-event="{&quot;action&quot;:&quot;sign_in&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;auth_cta&quot;,&quot;location&quot;:&quot;header&quot;,&quot;label&quot;:&quot;sign_in_link_auth_cta_header&quot;}" data-hydro-click="{&quot;event_type&quot;:&quot;authentication.click&quot;,&quot;payload&quot;:{&quot;location_in_page&quot;:&quot;site header menu&quot;,&quot;repository_id&quot;:null,&quot;auth_type&quot;:&quot;SIGN_UP&quot;,&quot;originating_url&quot;:&quot;https://github.com/feinan/leetcode-master/blob/master/problems/1047.%E5%88%A0%E9%99%A4%E5%AD%97%E7%AC%A6%E4%B8%B2%E4%B8%AD%E7%9A%84%E6%89%80%E6%9C%89%E7%9B%B8%E9%82%BB%E9%87%8D%E5%A4%8D%E9%A1%B9.md&quot;,&quot;user_id&quot;:null}}" data-hydro-click-hmac="72aabcab98031ef0f02f070b427e560e754461ebe59feef6a26ab6282ff4bfc2"><span class="Primer_Brand__Button-module__Button__text___ED0bX"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--100___B2ueX Primer_Brand__Text-module__Text--weight-medium___qJKf_ Primer_Brand__Button-module__Button--label___qrkyz Primer_Brand__Button-module__Button--label-subtle___8ndWH">Sign in</span></span></a><button class="Primer_Brand__Button-module__Button___scH9Z Primer_Brand__Button-module__Button--subtle___F7pEE Primer_Brand__Button-module__Button--size-small___zQrEw HeaderAppearanceSettings-module__trigger__hUheK" type="button" aria-haspopup="dialog" aria-labelledby="_R_3dd_"><span class="Primer_Brand__Button-module__Button__leading-visual___jjtTe" data-testid="Button-leading-visual"><svg data-component="Octicon" focusable="false" aria-hidden="true" class="octicon octicon-sliders Primer_Brand__Button-module__Button__icon-visual____qybb" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M15 2.75a.75.75 0 0 1-.75.75h-4a.75.75 0 0 1 0-1.5h4a.75.75 0 0 1 .75.75Zm-8.5.75v1.25a.75.75 0 0 0 1.5 0v-4a.75.75 0 0 0-1.5 0V2H1.75a.75.75 0 0 0 0 1.5H6.5Zm1.25 5.25a.75.75 0 0 0 0-1.5h-6a.75.75 0 0 0 0 1.5h6ZM15 8a.75.75 0 0 1-.75.75H11.5V10a.75.75 0 1 1-1.5 0V6a.75.75 0 0 1 1.5 0v1.25h2.75A.75.75 0 0 1 15 8Zm-9 5.25v-2a.75.75 0 0 0-1.5 0v1.25H1.75a.75.75 0 0 0 0 1.5H4.5v1.25a.75.75 0 0 0 1.5 0v-2Zm9 0a.75.75 0 0 1-.75.75h-6a.75.75 0 0 1 0-1.5h6a.75.75 0 0 1 .75.75Z"></path></svg></span><span class="Primer_Brand__Button-module__Button__text___ED0bX"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--100___B2ueX Primer_Brand__Text-module__Text--weight-medium___qJKf_ Primer_Brand__Button-module__Button--label___qrkyz Primer_Brand__Button-module__Button--label-subtle___8ndWH"></span></span></button><div class="Primer_Brand__Tooltip-module__Tooltip___0Eipx" data-direction="s" aria-hidden="true" id="_R_3dd_">Appearance settings</div></div></div><div class="MarketingHeader-module__menu__GIy3y"><div class="MarketingHeader-module__menuWrapper__owstH"><nav class="MarketingNavigation-module__nav__W0KYY" aria-label="Global"><ul class="MarketingNavigation-module__list__tFbMb"><li><div class="NavDropdown-module__container__l2YeI"><button type="button" class="NavDropdown-module__button__PEHWX" aria-expanded="false" aria-controls="_R_nd_">Platform<svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-triangle-right NavDropdown-module__buttonIcon__Tkl8_" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="m6.427 4.427 3.396 3.396a.25.25 0 0 1 0 .354l-3.396 3.396A.25.25 0 0 1 6 11.396V4.604a.25.25 0 0 1 .427-.177Z"></path></svg></button><div id="_R_nd_" class="NavDropdown-module__dropdown__xm1jd"><ul class="NavDropdown-module__list__zuCgG"><li><div class="NavGroup-module__group__W8SqJ"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--monospace___QXHDQ Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--100___B2ueX Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavGroup-module__title__Wzxz2" id="_R_5knd_">AI CODE CREATION</span><ul class="NavGroup-module__list__UCOFy" aria-labelledby="_R_5knd_"><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 NavLink-module__link__EG3d4" href="https://github.com/features/copilot" data-analytics-event="{&quot;action&quot;:&quot;github_copilot&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;platform&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;github_copilot_link_platform_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavLink-module__title__Q7t0p"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-copilot NavLink-module__icon__ltGNM" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M7.998 15.035c-4.562 0-7.873-2.914-7.998-3.749V9.338c.085-.628.677-1.686 1.588-2.065.013-.07.024-.143.036-.218.029-.183.06-.384.126-.612-.201-.508-.254-1.084-.254-1.656 0-.87.128-1.769.693-2.484.579-.733 1.494-1.124 2.724-1.261 1.206-.134 2.262.034 2.944.765.05.053.096.108.139.165.044-.057.094-.112.143-.165.682-.731 1.738-.899 2.944-.765 1.23.137 2.145.528 2.724 1.261.566.715.693 1.614.693 2.484 0 .572-.053 1.148-.254 1.656.066.228.098.429.126.612.012.076.024.148.037.218.924.385 1.522 1.471 1.591 2.095v1.872c0 .766-3.351 3.795-8.002 3.795Zm0-1.485c2.28 0 4.584-1.11 5.002-1.433V7.862l-.023-.116c-.49.21-1.075.291-1.727.291-1.146 0-2.059-.327-2.71-.991A3.222 3.222 0 0 1 8 6.303a3.24 3.24 0 0 1-.544.743c-.65.664-1.563.991-2.71.991-.652 0-1.236-.081-1.727-.291l-.023.116v4.255c.419.323 2.722 1.433 5.002 1.433ZM6.762 2.83c-.193-.206-.637-.413-1.682-.297-1.019.113-1.479.404-1.713.7-.247.312-.369.789-.369 1.554 0 .793.129 1.171.308 1.371.162.181.519.379 1.442.379.853 0 1.339-.235 1.638-.54.315-.322.527-.827.617-1.553.117-.935-.037-1.395-.241-1.614Zm4.155-.297c-1.044-.116-1.488.091-1.681.297-.204.219-.359.679-.242 1.614.091.726.303 1.231.618 1.553.299.305.784.54 1.638.54.922 0 1.28-.198 1.442-.379.179-.2.308-.578.308-1.371 0-.765-.123-1.242-.37-1.554-.233-.296-.693-.587-1.713-.7Z"></path><path d="M6.25 9.037a.75.75 0 0 1 .75.75v1.501a.75.75 0 0 1-1.5 0V9.787a.75.75 0 0 1 .75-.75Zm4.25.75v1.501a.75.75 0 0 1-1.5 0V9.787a.75.75 0 0 1 1.5 0Z"></path></svg>GitHub Copilot</span><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS NavLink-module__subtitle__X4gkW">Write better code with AI</span></span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 NavLink-module__link__EG3d4" href="https://github.com/features/ai/github-app" data-analytics-event="{&quot;action&quot;:&quot;github_copilot_app&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;platform&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;github_copilot_app_link_platform_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavLink-module__title__Q7t0p"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-mark-github NavLink-module__icon__ltGNM" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M6.766 11.328c-2.063-.25-3.516-1.734-3.516-3.656 0-.781.281-1.625.75-2.188-.203-.515-.172-1.609.063-2.062.625-.078 1.468.25 1.968.703.594-.187 1.219-.281 1.985-.281.765 0 1.39.094 1.953.265.484-.437 1.344-.765 1.969-.687.218.422.25 1.515.046 2.047.5.593.766 1.39.766 2.203 0 1.922-1.453 3.375-3.547 3.64.531.344.89 1.094.89 1.954v1.625c0 .468.391.734.86.547C13.781 14.359 16 11.53 16 8.03 16 3.61 12.406 0 7.984 0 3.563 0 0 3.61 0 8.031a7.88 7.88 0 0 0 5.172 7.422c.422.156.828-.125.828-.547v-1.25c-.219.094-.5.156-.75.156-1.031 0-1.64-.562-2.078-1.609-.172-.422-.36-.672-.719-.719-.187-.015-.25-.093-.25-.187 0-.188.313-.328.625-.328.453 0 .844.281 1.25.86.313.452.64.655 1.031.655s.641-.14 1-.5c.266-.265.47-.5.657-.656"></path></svg>GitHub Copilot app</span><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS NavLink-module__subtitle__X4gkW">Direct agents from issue to merge</span></span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 NavLink-module__link__EG3d4" href="https://github.com/mcp" data-analytics-event="{&quot;action&quot;:&quot;mcp_registry&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;platform&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;mcp_registry_link_platform_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavLink-module__title__Q7t0p"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-mcp NavLink-module__icon__ltGNM" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M5.52 1.12a3.578 3.578 0 0 1 6.078 2.98 3.578 3.578 0 0 1 2.982 6.08l-3.292 3.293a.252.252 0 0 0 0 .354l.843.843a.749.749 0 1 1-1.06 1.06l-.844-.843a1.75 1.75 0 0 1 0-2.474L13.52 9.12a2.08 2.08 0 0 0 0-2.94 2.08 2.08 0 0 0-2.94 0L7.731 9.03A.75.75 0 0 1 6.67 7.97l2.85-2.85a2.08 2.08 0 0 0 0-2.94 2.08 2.08 0 0 0-2.94 0l-4.799 4.8A.75.75 0 0 1 .72 5.92Z"></path><path d="M7.52 3.12a.749.749 0 1 1 1.06 1.06L5.731 7.03A2.079 2.079 0 0 0 8.67 9.97l2.85-2.85a.749.749 0 1 1 1.06 1.06l-2.849 2.85A3.578 3.578 0 0 1 4.67 5.97Z"></path></svg>MCP Registry</span><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS NavLink-module__subtitle__X4gkW">Integrate external tools</span></span></a></li></ul></div></li><li><div class="NavGroup-module__group__W8SqJ"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--monospace___QXHDQ Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--100___B2ueX Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavGroup-module__title__Wzxz2" id="_R_9knd_">DEVELOPER WORKFLOWS</span><ul class="NavGroup-module__list__UCOFy" aria-labelledby="_R_9knd_"><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 NavLink-module__link__EG3d4" href="https://github.com/features/actions" data-analytics-event="{&quot;action&quot;:&quot;actions&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;platform&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;actions_link_platform_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavLink-module__title__Q7t0p"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-workflow NavLink-module__icon__ltGNM" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M0 1.75C0 .784.784 0 1.75 0h3.5C6.216 0 7 .784 7 1.75v3.5A1.75 1.75 0 0 1 5.25 7H4v4a1 1 0 0 0 1 1h4v-1.25C9 9.784 9.784 9 10.75 9h3.5c.966 0 1.75.784 1.75 1.75v3.5A1.75 1.75 0 0 1 14.25 16h-3.5A1.75 1.75 0 0 1 9 14.25v-.75H5A2.5 2.5 0 0 1 2.5 11V7h-.75A1.75 1.75 0 0 1 0 5.25Zm1.75-.25a.25.25 0 0 0-.25.25v3.5c0 .138.112.25.25.25h3.5a.25.25 0 0 0 .25-.25v-3.5a.25.25 0 0 0-.25-.25Zm9 9a.25.25 0 0 0-.25.25v3.5c0 .138.112.25.25.25h3.5a.25.25 0 0 0 .25-.25v-3.5a.25.25 0 0 0-.25-.25Z"></path></svg>Actions</span><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS NavLink-module__subtitle__X4gkW">Automate any workflow</span></span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 NavLink-module__link__EG3d4" href="https://github.com/features/codespaces" data-analytics-event="{&quot;action&quot;:&quot;codespaces&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;platform&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;codespaces_link_platform_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavLink-module__title__Q7t0p"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-codespaces NavLink-module__icon__ltGNM" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M0 11.25c0-.966.784-1.75 1.75-1.75h12.5c.966 0 1.75.784 1.75 1.75v3A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25Zm2-9.5C2 .784 2.784 0 3.75 0h8.5C13.216 0 14 .784 14 1.75v5a1.75 1.75 0 0 1-1.75 1.75h-8.5A1.75 1.75 0 0 1 2 6.75Zm1.75-.25a.25.25 0 0 0-.25.25v5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-5a.25.25 0 0 0-.25-.25Zm-2 9.5a.25.25 0 0 0-.25.25v3c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25v-3a.25.25 0 0 0-.25-.25Z"></path><path d="M7 12.75a.75.75 0 0 1 .75-.75h4.5a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1-.75-.75Zm-4 0a.75.75 0 0 1 .75-.75h.5a.75.75 0 0 1 0 1.5h-.5a.75.75 0 0 1-.75-.75Z"></path></svg>Codespaces</span><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS NavLink-module__subtitle__X4gkW">Instant dev environments</span></span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 NavLink-module__link__EG3d4" href="https://github.com/features/issues" data-analytics-event="{&quot;action&quot;:&quot;issues&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;platform&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;issues_link_platform_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavLink-module__title__Q7t0p"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-issue-opened NavLink-module__icon__ltGNM" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M8 9.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path><path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Z"></path></svg>Issues</span><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS NavLink-module__subtitle__X4gkW">Plan and track work</span></span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 NavLink-module__link__EG3d4" href="https://github.com/features/code-review" data-analytics-event="{&quot;action&quot;:&quot;code_review&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;platform&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;code_review_link_platform_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavLink-module__title__Q7t0p"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-code NavLink-module__icon__ltGNM" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="m11.28 3.22 4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734L13.94 8l-3.72-3.72a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215Zm-6.56 0a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042L2.06 8l3.72 3.72a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L.47 8.53a.75.75 0 0 1 0-1.06Z"></path></svg>Code Review</span><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS NavLink-module__subtitle__X4gkW">Manage code changes</span></span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 NavLink-module__link__EG3d4" href="https://github.com/features/code-quality" data-analytics-event="{&quot;action&quot;:&quot;code_quality&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;platform&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;code_quality_link_platform_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavLink-module__title__Q7t0p"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-codescan-checkmark NavLink-module__icon__ltGNM" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M10.28 6.28a.75.75 0 1 0-1.06-1.06L6.25 8.19l-.97-.97a.75.75 0 0 0-1.06 1.06l1.5 1.5a.75.75 0 0 0 1.06 0l3.5-3.5Z"></path><path d="M7.5 15a7.5 7.5 0 1 1 5.807-2.754l2.473 2.474a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215l-2.474-2.473A7.472 7.472 0 0 1 7.5 15Zm0-13.5a6 6 0 1 0 4.094 10.386.748.748 0 0 1 .293-.292 6.002 6.002 0 0 0 1.117-6.486A6.002 6.002 0 0 0 7.5 1.5Z"></path></svg>Code Quality</span><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS NavLink-module__subtitle__X4gkW">Enforce quality at merge</span></span></a></li></ul></div></li><li><div class="NavGroup-module__group__W8SqJ"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--monospace___QXHDQ Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--100___B2ueX Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavGroup-module__title__Wzxz2" id="_R_dknd_">APPLICATION SECURITY</span><ul class="NavGroup-module__list__UCOFy" aria-labelledby="_R_dknd_"><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 NavLink-module__link__EG3d4" href="https://github.com/security/advanced-security" data-analytics-event="{&quot;action&quot;:&quot;github_advanced_security&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;platform&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;github_advanced_security_link_platform_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavLink-module__title__Q7t0p"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-shield-check NavLink-module__icon__ltGNM" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="m8.533.133 5.25 1.68A1.75 1.75 0 0 1 15 3.48V7c0 1.566-.32 3.182-1.303 4.682-.983 1.498-2.585 2.813-5.032 3.855a1.697 1.697 0 0 1-1.33 0c-2.447-1.042-4.049-2.357-5.032-3.855C1.32 10.182 1 8.566 1 7V3.48a1.75 1.75 0 0 1 1.217-1.667l5.25-1.68a1.748 1.748 0 0 1 1.066 0Zm-.61 1.429.001.001-5.25 1.68a.251.251 0 0 0-.174.237V7c0 1.36.275 2.666 1.057 3.859.784 1.194 2.121 2.342 4.366 3.298a.196.196 0 0 0 .154 0c2.245-.957 3.582-2.103 4.366-3.297C13.225 9.666 13.5 8.358 13.5 7V3.48a.25.25 0 0 0-.174-.238l-5.25-1.68a.25.25 0 0 0-.153 0ZM11.28 6.28l-3.5 3.5a.75.75 0 0 1-1.06 0l-1.5-1.5a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215l.97.97 2.97-2.97a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042Z"></path></svg>GitHub Advanced Security</span><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS NavLink-module__subtitle__X4gkW">Find and fix vulnerabilities</span></span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 NavLink-module__link__EG3d4" href="https://github.com/security/advanced-security/code-security" data-analytics-event="{&quot;action&quot;:&quot;code_security&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;platform&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;code_security_link_platform_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavLink-module__title__Q7t0p"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-code-square NavLink-module__icon__ltGNM" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25Zm7.47 3.97a.75.75 0 0 1 1.06 0l2 2a.75.75 0 0 1 0 1.06l-2 2a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734L10.69 8 9.22 6.53a.75.75 0 0 1 0-1.06ZM6.78 6.53 5.31 8l1.47 1.47a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215l-2-2a.75.75 0 0 1 0-1.06l2-2a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042Z"></path></svg>Code security</span><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS NavLink-module__subtitle__X4gkW">Secure your code as you build</span></span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 NavLink-module__link__EG3d4" href="https://github.com/security/advanced-security/secret-protection" data-analytics-event="{&quot;action&quot;:&quot;secret_protection&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;platform&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;secret_protection_link_platform_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavLink-module__title__Q7t0p"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-lock NavLink-module__icon__ltGNM" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M4 4a4 4 0 0 1 8 0v2h.25c.966 0 1.75.784 1.75 1.75v5.5A1.75 1.75 0 0 1 12.25 15h-8.5A1.75 1.75 0 0 1 2 13.25v-5.5C2 6.784 2.784 6 3.75 6H4Zm8.25 3.5h-8.5a.25.25 0 0 0-.25.25v5.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-5.5a.25.25 0 0 0-.25-.25ZM10.5 6V4a2.5 2.5 0 1 0-5 0v2Z"></path></svg>Secret protection</span><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS NavLink-module__subtitle__X4gkW">Stop leaks before they start</span></span></a></li></ul></div></li><li><div class="NavGroup-module__group__W8SqJ NavGroup-module__hasSeparator__FnMrN"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--monospace___QXHDQ Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--100___B2ueX Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavGroup-module__title__Wzxz2" id="_R_hknd_">EXPLORE</span><ul class="NavGroup-module__list__UCOFy" aria-labelledby="_R_hknd_"><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/why-github" data-analytics-event="{&quot;action&quot;:&quot;why_github&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;platform&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;why_github_link_platform_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Why GitHub</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 Primer_Brand__Link-module__Link--is-external___xsncV" href="https://docs.github.com" data-analytics-event="{&quot;action&quot;:&quot;documentation&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;platform&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;documentation_link_platform_navbar&quot;}" target="_blank" rel="noreferrer"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Documentation</span><svg data-component="Octicon" focusable="false" aria-label="External link" class="octicon octicon-link-external" role="img" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 Primer_Brand__Link-module__Link--is-external___xsncV" href="https://github.blog" data-analytics-event="{&quot;action&quot;:&quot;blog&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;platform&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;blog_link_platform_navbar&quot;}" target="_blank" rel="noreferrer"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Blog</span><svg data-component="Octicon" focusable="false" aria-label="External link" class="octicon octicon-link-external" role="img" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 Primer_Brand__Link-module__Link--is-external___xsncV" href="https://github.blog/changelog" data-analytics-event="{&quot;action&quot;:&quot;changelog&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;platform&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;changelog_link_platform_navbar&quot;}" target="_blank" rel="noreferrer"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Changelog</span><svg data-component="Octicon" focusable="false" aria-label="External link" class="octicon octicon-link-external" role="img" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/marketplace" data-analytics-event="{&quot;action&quot;:&quot;marketplace&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;platform&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;marketplace_link_platform_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Marketplace</span></a></li></ul></div></li></ul><div class="NavDropdown-module__trailingLinkContainer__VgJGL"><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 Primer_Brand__Link-module__Link--arrow-end___esdN8" href="https://github.com/features" data-analytics-event="{&quot;action&quot;:&quot;view_all_features&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;platform&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;view_all_features_link_platform_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">View all features</span><svg class="Primer_Brand__ExpandableArrow-module__ExpandableArrow___aaZs9 Primer_Brand__Link-module__Link-arrow___yd78i" width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true" focusable="false"><path fill="currentColor" d="M7.28033 3.21967C6.98744 2.92678 6.51256 2.92678 6.21967 3.21967C5.92678 3.51256 5.92678 3.98744 6.21967 4.28033L7.28033 3.21967ZM11 8L11.5303 8.53033C11.8232 8.23744 11.8232 7.76256 11.5303 7.46967L11 8ZM6.21967 11.7197C5.92678 12.0126 5.92678 12.4874 6.21967 12.7803C6.51256 13.0732 6.98744 13.0732 7.28033 12.7803L6.21967 11.7197ZM6.21967 4.28033L10.4697 8.53033L11.5303 7.46967L7.28033 3.21967L6.21967 4.28033ZM10.4697 7.46967L6.21967 11.7197L7.28033 12.7803L11.5303 8.53033L10.4697 7.46967Z"></path><path class="Primer_Brand__ExpandableArrow-module__ExpandableArrow-stem___0K8Hz" stroke="currentColor" d="M1.75 8H11" stroke-width="1.5" stroke-linecap="round"></path></svg></a></div></div></div></li><li><div class="NavDropdown-module__container__l2YeI"><button type="button" class="NavDropdown-module__button__PEHWX" aria-expanded="false" aria-controls="_R_17d_">Solutions<svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-triangle-right NavDropdown-module__buttonIcon__Tkl8_" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="m6.427 4.427 3.396 3.396a.25.25 0 0 1 0 .354l-3.396 3.396A.25.25 0 0 1 6 11.396V4.604a.25.25 0 0 1 .427-.177Z"></path></svg></button><div id="_R_17d_" class="NavDropdown-module__dropdown__xm1jd"><ul class="NavDropdown-module__list__zuCgG"><li><div class="NavGroup-module__group__W8SqJ"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--monospace___QXHDQ Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--100___B2ueX Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavGroup-module__title__Wzxz2" id="_R_5l7d_">BY COMPANY SIZE</span><ul class="NavGroup-module__list__UCOFy" aria-labelledby="_R_5l7d_"><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/enterprise" data-analytics-event="{&quot;action&quot;:&quot;enterprises&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;solutions&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;enterprises_link_solutions_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Enterprises</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/team" data-analytics-event="{&quot;action&quot;:&quot;small_and_medium_teams&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;solutions&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;small_and_medium_teams_link_solutions_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Small and medium teams</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/enterprise/startups" data-analytics-event="{&quot;action&quot;:&quot;startups&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;solutions&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;startups_link_solutions_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Startups</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/solutions/industry/nonprofits" data-analytics-event="{&quot;action&quot;:&quot;nonprofits&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;solutions&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;nonprofits_link_solutions_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Nonprofits</span></a></li></ul></div></li><li><div class="NavGroup-module__group__W8SqJ"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--monospace___QXHDQ Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--100___B2ueX Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavGroup-module__title__Wzxz2" id="_R_9l7d_">BY USE CASE</span><ul class="NavGroup-module__list__UCOFy" aria-labelledby="_R_9l7d_"><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/solutions/use-case/app-modernization" data-analytics-event="{&quot;action&quot;:&quot;app_modernization&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;solutions&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;app_modernization_link_solutions_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">App Modernization</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/solutions/use-case/devsecops" data-analytics-event="{&quot;action&quot;:&quot;devsecops&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;solutions&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;devsecops_link_solutions_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">DevSecOps</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/solutions/use-case/devops" data-analytics-event="{&quot;action&quot;:&quot;devops&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;solutions&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;devops_link_solutions_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">DevOps</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/solutions/use-case/ci-cd" data-analytics-event="{&quot;action&quot;:&quot;ci/cd&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;solutions&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;ci/cd_link_solutions_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">CI/CD</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 Primer_Brand__Link-module__Link--arrow-end___esdN8" href="https://github.com/solutions/use-case" data-analytics-event="{&quot;action&quot;:&quot;view_all_use_cases&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;solutions&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;view_all_use_cases_link_solutions_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">View all use cases</span><svg class="Primer_Brand__ExpandableArrow-module__ExpandableArrow___aaZs9 Primer_Brand__Link-module__Link-arrow___yd78i" width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true" focusable="false"><path fill="currentColor" d="M7.28033 3.21967C6.98744 2.92678 6.51256 2.92678 6.21967 3.21967C5.92678 3.51256 5.92678 3.98744 6.21967 4.28033L7.28033 3.21967ZM11 8L11.5303 8.53033C11.8232 8.23744 11.8232 7.76256 11.5303 7.46967L11 8ZM6.21967 11.7197C5.92678 12.0126 5.92678 12.4874 6.21967 12.7803C6.51256 13.0732 6.98744 13.0732 7.28033 12.7803L6.21967 11.7197ZM6.21967 4.28033L10.4697 8.53033L11.5303 7.46967L7.28033 3.21967L6.21967 4.28033ZM10.4697 7.46967L6.21967 11.7197L7.28033 12.7803L11.5303 8.53033L10.4697 7.46967Z"></path><path class="Primer_Brand__ExpandableArrow-module__ExpandableArrow-stem___0K8Hz" stroke="currentColor" d="M1.75 8H11" stroke-width="1.5" stroke-linecap="round"></path></svg></a></li></ul></div></li><li><div class="NavGroup-module__group__W8SqJ"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--monospace___QXHDQ Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--100___B2ueX Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavGroup-module__title__Wzxz2" id="_R_dl7d_">BY INDUSTRY</span><ul class="NavGroup-module__list__UCOFy" aria-labelledby="_R_dl7d_"><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/solutions/industry/healthcare" data-analytics-event="{&quot;action&quot;:&quot;healthcare&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;solutions&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;healthcare_link_solutions_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Healthcare</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/solutions/industry/financial-services" data-analytics-event="{&quot;action&quot;:&quot;financial_services&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;solutions&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;financial_services_link_solutions_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Financial services</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/solutions/industry/manufacturing" data-analytics-event="{&quot;action&quot;:&quot;manufacturing&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;solutions&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;manufacturing_link_solutions_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Manufacturing</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/solutions/industry/government" data-analytics-event="{&quot;action&quot;:&quot;government&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;solutions&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;government_link_solutions_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Government</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 Primer_Brand__Link-module__Link--arrow-end___esdN8" href="https://github.com/solutions/industry" data-analytics-event="{&quot;action&quot;:&quot;view_all_industries&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;solutions&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;view_all_industries_link_solutions_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">View all industries</span><svg class="Primer_Brand__ExpandableArrow-module__ExpandableArrow___aaZs9 Primer_Brand__Link-module__Link-arrow___yd78i" width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true" focusable="false"><path fill="currentColor" d="M7.28033 3.21967C6.98744 2.92678 6.51256 2.92678 6.21967 3.21967C5.92678 3.51256 5.92678 3.98744 6.21967 4.28033L7.28033 3.21967ZM11 8L11.5303 8.53033C11.8232 8.23744 11.8232 7.76256 11.5303 7.46967L11 8ZM6.21967 11.7197C5.92678 12.0126 5.92678 12.4874 6.21967 12.7803C6.51256 13.0732 6.98744 13.0732 7.28033 12.7803L6.21967 11.7197ZM6.21967 4.28033L10.4697 8.53033L11.5303 7.46967L7.28033 3.21967L6.21967 4.28033ZM10.4697 7.46967L6.21967 11.7197L7.28033 12.7803L11.5303 8.53033L10.4697 7.46967Z"></path><path class="Primer_Brand__ExpandableArrow-module__ExpandableArrow-stem___0K8Hz" stroke="currentColor" d="M1.75 8H11" stroke-width="1.5" stroke-linecap="round"></path></svg></a></li></ul></div></li></ul><div class="NavDropdown-module__trailingLinkContainer__VgJGL"><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 Primer_Brand__Link-module__Link--arrow-end___esdN8" href="https://github.com/solutions" data-analytics-event="{&quot;action&quot;:&quot;view_all_solutions&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;solutions&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;view_all_solutions_link_solutions_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">View all solutions</span><svg class="Primer_Brand__ExpandableArrow-module__ExpandableArrow___aaZs9 Primer_Brand__Link-module__Link-arrow___yd78i" width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true" focusable="false"><path fill="currentColor" d="M7.28033 3.21967C6.98744 2.92678 6.51256 2.92678 6.21967 3.21967C5.92678 3.51256 5.92678 3.98744 6.21967 4.28033L7.28033 3.21967ZM11 8L11.5303 8.53033C11.8232 8.23744 11.8232 7.76256 11.5303 7.46967L11 8ZM6.21967 11.7197C5.92678 12.0126 5.92678 12.4874 6.21967 12.7803C6.51256 13.0732 6.98744 13.0732 7.28033 12.7803L6.21967 11.7197ZM6.21967 4.28033L10.4697 8.53033L11.5303 7.46967L7.28033 3.21967L6.21967 4.28033ZM10.4697 7.46967L6.21967 11.7197L7.28033 12.7803L11.5303 8.53033L10.4697 7.46967Z"></path><path class="Primer_Brand__ExpandableArrow-module__ExpandableArrow-stem___0K8Hz" stroke="currentColor" d="M1.75 8H11" stroke-width="1.5" stroke-linecap="round"></path></svg></a></div></div></div></li><li><div class="NavDropdown-module__container__l2YeI"><button type="button" class="NavDropdown-module__button__PEHWX" aria-expanded="false" aria-controls="_R_1nd_">Resources<svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-triangle-right NavDropdown-module__buttonIcon__Tkl8_" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="m6.427 4.427 3.396 3.396a.25.25 0 0 1 0 .354l-3.396 3.396A.25.25 0 0 1 6 11.396V4.604a.25.25 0 0 1 .427-.177Z"></path></svg></button><div id="_R_1nd_" class="NavDropdown-module__dropdown__xm1jd"><ul class="NavDropdown-module__list__zuCgG"><li><div class="NavGroup-module__group__W8SqJ"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--monospace___QXHDQ Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--100___B2ueX Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavGroup-module__title__Wzxz2" id="_R_5lnd_">EXPLORE BY TOPIC</span><ul class="NavGroup-module__list__UCOFy" aria-labelledby="_R_5lnd_"><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/resources/articles?topic=ai" data-analytics-event="{&quot;action&quot;:&quot;ai&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;resources&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;ai_link_resources_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">AI</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/resources/articles?topic=software-development" data-analytics-event="{&quot;action&quot;:&quot;software_development&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;resources&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;software_development_link_resources_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Software Development</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/resources/articles?topic=devops" data-analytics-event="{&quot;action&quot;:&quot;devops&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;resources&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;devops_link_resources_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">DevOps</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/resources/articles?topic=security" data-analytics-event="{&quot;action&quot;:&quot;security&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;resources&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;security_link_resources_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Security</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 Primer_Brand__Link-module__Link--arrow-end___esdN8" href="https://github.com/resources/articles" data-analytics-event="{&quot;action&quot;:&quot;view_all_topics&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;resources&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;view_all_topics_link_resources_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">View all topics</span><svg class="Primer_Brand__ExpandableArrow-module__ExpandableArrow___aaZs9 Primer_Brand__Link-module__Link-arrow___yd78i" width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true" focusable="false"><path fill="currentColor" d="M7.28033 3.21967C6.98744 2.92678 6.51256 2.92678 6.21967 3.21967C5.92678 3.51256 5.92678 3.98744 6.21967 4.28033L7.28033 3.21967ZM11 8L11.5303 8.53033C11.8232 8.23744 11.8232 7.76256 11.5303 7.46967L11 8ZM6.21967 11.7197C5.92678 12.0126 5.92678 12.4874 6.21967 12.7803C6.51256 13.0732 6.98744 13.0732 7.28033 12.7803L6.21967 11.7197ZM6.21967 4.28033L10.4697 8.53033L11.5303 7.46967L7.28033 3.21967L6.21967 4.28033ZM10.4697 7.46967L6.21967 11.7197L7.28033 12.7803L11.5303 8.53033L10.4697 7.46967Z"></path><path class="Primer_Brand__ExpandableArrow-module__ExpandableArrow-stem___0K8Hz" stroke="currentColor" d="M1.75 8H11" stroke-width="1.5" stroke-linecap="round"></path></svg></a></li></ul></div></li><li><div class="NavGroup-module__group__W8SqJ"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--monospace___QXHDQ Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--100___B2ueX Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavGroup-module__title__Wzxz2" id="_R_9lnd_">EXPLORE BY TYPE</span><ul class="NavGroup-module__list__UCOFy" aria-labelledby="_R_9lnd_"><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/customer-stories" data-analytics-event="{&quot;action&quot;:&quot;customer_stories&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;resources&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;customer_stories_link_resources_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Customer stories</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/resources/events" data-analytics-event="{&quot;action&quot;:&quot;events__webinars&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;resources&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;events__webinars_link_resources_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Events &amp; webinars</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/resources/whitepapers" data-analytics-event="{&quot;action&quot;:&quot;ebooks__reports&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;resources&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;ebooks__reports_link_resources_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Ebooks &amp; reports</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/solutions/executive-insights" data-analytics-event="{&quot;action&quot;:&quot;business_insights&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;resources&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;business_insights_link_resources_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Business insights</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 Primer_Brand__Link-module__Link--is-external___xsncV" href="https://skills.github.com" data-analytics-event="{&quot;action&quot;:&quot;github_skills&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;resources&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;github_skills_link_resources_navbar&quot;}" target="_blank" rel="noreferrer"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">GitHub Skills</span><svg data-component="Octicon" focusable="false" aria-label="External link" class="octicon octicon-link-external" role="img" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg></a></li></ul></div></li><li><div class="NavGroup-module__group__W8SqJ"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--monospace___QXHDQ Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--100___B2ueX Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavGroup-module__title__Wzxz2" id="_R_dlnd_">SUPPORT &amp; SERVICES</span><ul class="NavGroup-module__list__UCOFy" aria-labelledby="_R_dlnd_"><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 Primer_Brand__Link-module__Link--is-external___xsncV" href="https://docs.github.com" data-analytics-event="{&quot;action&quot;:&quot;documentation&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;resources&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;documentation_link_resources_navbar&quot;}" target="_blank" rel="noreferrer"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Documentation</span><svg data-component="Octicon" focusable="false" aria-label="External link" class="octicon octicon-link-external" role="img" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 Primer_Brand__Link-module__Link--is-external___xsncV" href="https://support.github.com" data-analytics-event="{&quot;action&quot;:&quot;customer_support&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;resources&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;customer_support_link_resources_navbar&quot;}" target="_blank" rel="noreferrer"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Customer support</span><svg data-component="Octicon" focusable="false" aria-label="External link" class="octicon octicon-link-external" role="img" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/orgs/community/discussions" data-analytics-event="{&quot;action&quot;:&quot;community_forum&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;resources&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;community_forum_link_resources_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Community forum</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/trust-center" data-analytics-event="{&quot;action&quot;:&quot;trust_center&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;resources&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;trust_center_link_resources_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Trust center</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/partners" data-analytics-event="{&quot;action&quot;:&quot;partners&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;resources&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;partners_link_resources_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Partners</span></a></li></ul></div></li></ul><div class="NavDropdown-module__trailingLinkContainer__VgJGL"><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 Primer_Brand__Link-module__Link--arrow-end___esdN8" href="https://github.com/resources" data-analytics-event="{&quot;action&quot;:&quot;view_all_resources&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;resources&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;view_all_resources_link_resources_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">View all resources</span><svg class="Primer_Brand__ExpandableArrow-module__ExpandableArrow___aaZs9 Primer_Brand__Link-module__Link-arrow___yd78i" width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true" focusable="false"><path fill="currentColor" d="M7.28033 3.21967C6.98744 2.92678 6.51256 2.92678 6.21967 3.21967C5.92678 3.51256 5.92678 3.98744 6.21967 4.28033L7.28033 3.21967ZM11 8L11.5303 8.53033C11.8232 8.23744 11.8232 7.76256 11.5303 7.46967L11 8ZM6.21967 11.7197C5.92678 12.0126 5.92678 12.4874 6.21967 12.7803C6.51256 13.0732 6.98744 13.0732 7.28033 12.7803L6.21967 11.7197ZM6.21967 4.28033L10.4697 8.53033L11.5303 7.46967L7.28033 3.21967L6.21967 4.28033ZM10.4697 7.46967L6.21967 11.7197L7.28033 12.7803L11.5303 8.53033L10.4697 7.46967Z"></path><path class="Primer_Brand__ExpandableArrow-module__ExpandableArrow-stem___0K8Hz" stroke="currentColor" d="M1.75 8H11" stroke-width="1.5" stroke-linecap="round"></path></svg></a></div></div></div></li><li><div class="NavDropdown-module__container__l2YeI"><button type="button" class="NavDropdown-module__button__PEHWX" aria-expanded="false" aria-controls="_R_27d_">Open Source<svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-triangle-right NavDropdown-module__buttonIcon__Tkl8_" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="m6.427 4.427 3.396 3.396a.25.25 0 0 1 0 .354l-3.396 3.396A.25.25 0 0 1 6 11.396V4.604a.25.25 0 0 1 .427-.177Z"></path></svg></button><div id="_R_27d_" class="NavDropdown-module__dropdown__xm1jd"><ul class="NavDropdown-module__list__zuCgG"><li><div class="NavGroup-module__group__W8SqJ"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--monospace___QXHDQ Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--100___B2ueX Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavGroup-module__title__Wzxz2" id="_R_5m7d_">COMMUNITY</span><ul class="NavGroup-module__list__UCOFy" aria-labelledby="_R_5m7d_"><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 NavLink-module__link__EG3d4" href="https://github.com/open-source/sponsors" data-analytics-event="{&quot;action&quot;:&quot;github_sponsors&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;open_source&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;github_sponsors_link_open_source_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavLink-module__title__Q7t0p"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-sponsor-tiers NavLink-module__icon__ltGNM" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M10.586 1C12.268 1 13.5 2.37 13.5 4.25c0 1.745-.996 3.359-2.622 4.831-.166.15-.336.297-.509.438l1.116 5.584a.75.75 0 0 1-.991.852l-2.409-.876a.25.25 0 0 0-.17 0l-2.409.876a.75.75 0 0 1-.991-.852L5.63 9.519a13.78 13.78 0 0 1-.51-.438C3.497 7.609 2.5 5.995 2.5 4.25 2.5 2.37 3.732 1 5.414 1c.963 0 1.843.403 2.474 1.073L8 2.198l.112-.125a3.385 3.385 0 0 1 2.283-1.068L10.586 1Zm-3.621 9.495-.718 3.594 1.155-.42a1.75 1.75 0 0 1 1.028-.051l.168.051 1.154.42-.718-3.592c-.199.13-.37.235-.505.314l-.169.097a.75.75 0 0 1-.72 0 9.54 9.54 0 0 1-.515-.308l-.16-.105ZM10.586 2.5c-.863 0-1.611.58-1.866 1.459-.209.721-1.231.721-1.44 0C7.025 3.08 6.277 2.5 5.414 2.5 4.598 2.5 4 3.165 4 4.25c0 1.23.786 2.504 2.128 3.719.49.443 1.018.846 1.546 1.198l.325.21.076-.047.251-.163a13.341 13.341 0 0 0 1.546-1.198C11.214 6.754 12 5.479 12 4.25c0-1.085-.598-1.75-1.414-1.75Z"></path></svg>GitHub Sponsors</span><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS NavLink-module__subtitle__X4gkW">Fund open source developers</span></span></a></li></ul></div></li><li><div class="NavGroup-module__group__W8SqJ"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--monospace___QXHDQ Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--100___B2ueX Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavGroup-module__title__Wzxz2" id="_R_9m7d_">PROGRAMS</span><ul class="NavGroup-module__list__UCOFy" aria-labelledby="_R_9m7d_"><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 Primer_Brand__Link-module__Link--is-external___xsncV" href="https://securitylab.github.com" data-analytics-event="{&quot;action&quot;:&quot;security_lab&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;open_source&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;security_lab_link_open_source_navbar&quot;}" target="_blank" rel="noreferrer"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Security Lab</span><svg data-component="Octicon" focusable="false" aria-label="External link" class="octicon octicon-link-external" role="img" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 Primer_Brand__Link-module__Link--is-external___xsncV" href="https://maintainers.github.com" data-analytics-event="{&quot;action&quot;:&quot;maintainer_community&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;open_source&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;maintainer_community_link_open_source_navbar&quot;}" target="_blank" rel="noreferrer"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Maintainer Community</span><svg data-component="Octicon" focusable="false" aria-label="External link" class="octicon octicon-link-external" role="img" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 Primer_Brand__Link-module__Link--is-external___xsncV" href="https://stars.github.com" data-analytics-event="{&quot;action&quot;:&quot;github_stars&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;open_source&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;github_stars_link_open_source_navbar&quot;}" target="_blank" rel="noreferrer"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">GitHub Stars</span><svg data-component="Octicon" focusable="false" aria-label="External link" class="octicon octicon-link-external" role="img" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 Primer_Brand__Link-module__Link--is-external___xsncV" href="https://archiveprogram.github.com" data-analytics-event="{&quot;action&quot;:&quot;archive_program&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;open_source&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;archive_program_link_open_source_navbar&quot;}" target="_blank" rel="noreferrer"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Archive Program</span><svg data-component="Octicon" focusable="false" aria-label="External link" class="octicon octicon-link-external" role="img" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg></a></li></ul></div></li><li><div class="NavGroup-module__group__W8SqJ"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--monospace___QXHDQ Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--100___B2ueX Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavGroup-module__title__Wzxz2" id="_R_dm7d_">REPOSITORIES</span><ul class="NavGroup-module__list__UCOFy" aria-labelledby="_R_dm7d_"><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/topics" data-analytics-event="{&quot;action&quot;:&quot;topics&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;open_source&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;topics_link_open_source_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Topics</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/trending" data-analytics-event="{&quot;action&quot;:&quot;trending&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;open_source&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;trending_link_open_source_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Trending</span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0" href="https://github.com/collections" data-analytics-event="{&quot;action&quot;:&quot;collections&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;open_source&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;collections_link_open_source_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty">Collections</span></a></li></ul></div></li></ul></div></div></li><li><div class="NavDropdown-module__container__l2YeI"><button type="button" class="NavDropdown-module__button__PEHWX" aria-expanded="false" aria-controls="_R_2nd_">Enterprise<svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-triangle-right NavDropdown-module__buttonIcon__Tkl8_" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="m6.427 4.427 3.396 3.396a.25.25 0 0 1 0 .354l-3.396 3.396A.25.25 0 0 1 6 11.396V4.604a.25.25 0 0 1 .427-.177Z"></path></svg></button><div id="_R_2nd_" class="NavDropdown-module__dropdown__xm1jd"><ul class="NavDropdown-module__list__zuCgG"><li><div class="NavGroup-module__group__W8SqJ"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--monospace___QXHDQ Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--100___B2ueX Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavGroup-module__title__Wzxz2" id="_R_5mnd_">ENTERPRISE SOLUTIONS</span><ul class="NavGroup-module__list__UCOFy" aria-labelledby="_R_5mnd_"><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 NavLink-module__link__EG3d4" href="https://github.com/enterprise" data-analytics-event="{&quot;action&quot;:&quot;enterprise_platform&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;enterprise&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;enterprise_platform_link_enterprise_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavLink-module__title__Q7t0p"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-stack NavLink-module__icon__ltGNM" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M7.122.392a1.75 1.75 0 0 1 1.756 0l5.003 2.902c.83.481.83 1.68 0 2.162L8.878 8.358a1.75 1.75 0 0 1-1.756 0L2.119 5.456a1.251 1.251 0 0 1 0-2.162ZM8.125 1.69a.248.248 0 0 0-.25 0l-4.63 2.685 4.63 2.685a.248.248 0 0 0 .25 0l4.63-2.685ZM1.601 7.789a.75.75 0 0 1 1.025-.273l5.249 3.044a.248.248 0 0 0 .25 0l5.249-3.044a.75.75 0 0 1 .752 1.298l-5.248 3.044a1.75 1.75 0 0 1-1.756 0L1.874 8.814A.75.75 0 0 1 1.6 7.789Zm0 3.5a.75.75 0 0 1 1.025-.273l5.249 3.044a.248.248 0 0 0 .25 0l5.249-3.044a.75.75 0 0 1 .752 1.298l-5.248 3.044a1.75 1.75 0 0 1-1.756 0l-5.248-3.044a.75.75 0 0 1-.273-1.025Z"></path></svg>Enterprise platform</span><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS NavLink-module__subtitle__X4gkW">AI-powered developer platform</span></span></a></li></ul></div></li><li><div class="NavGroup-module__group__W8SqJ"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--monospace___QXHDQ Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--100___B2ueX Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavGroup-module__title__Wzxz2" id="_R_9mnd_">AVAILABLE ADD-ONS</span><ul class="NavGroup-module__list__UCOFy" aria-labelledby="_R_9mnd_"><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 NavLink-module__link__EG3d4" href="https://github.com/security/advanced-security" data-analytics-event="{&quot;action&quot;:&quot;github_advanced_security&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;enterprise&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;github_advanced_security_link_enterprise_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavLink-module__title__Q7t0p"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-shield-check NavLink-module__icon__ltGNM" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="m8.533.133 5.25 1.68A1.75 1.75 0 0 1 15 3.48V7c0 1.566-.32 3.182-1.303 4.682-.983 1.498-2.585 2.813-5.032 3.855a1.697 1.697 0 0 1-1.33 0c-2.447-1.042-4.049-2.357-5.032-3.855C1.32 10.182 1 8.566 1 7V3.48a1.75 1.75 0 0 1 1.217-1.667l5.25-1.68a1.748 1.748 0 0 1 1.066 0Zm-.61 1.429.001.001-5.25 1.68a.251.251 0 0 0-.174.237V7c0 1.36.275 2.666 1.057 3.859.784 1.194 2.121 2.342 4.366 3.298a.196.196 0 0 0 .154 0c2.245-.957 3.582-2.103 4.366-3.297C13.225 9.666 13.5 8.358 13.5 7V3.48a.25.25 0 0 0-.174-.238l-5.25-1.68a.25.25 0 0 0-.153 0ZM11.28 6.28l-3.5 3.5a.75.75 0 0 1-1.06 0l-1.5-1.5a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215l.97.97 2.97-2.97a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042Z"></path></svg>GitHub Advanced Security</span><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS NavLink-module__subtitle__X4gkW">Enterprise-grade security features</span></span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 NavLink-module__link__EG3d4" href="https://github.com/features/copilot/copilot-business" data-analytics-event="{&quot;action&quot;:&quot;copilot_for_business&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;enterprise&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;copilot_for_business_link_enterprise_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavLink-module__title__Q7t0p"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-copilot NavLink-module__icon__ltGNM" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M7.998 15.035c-4.562 0-7.873-2.914-7.998-3.749V9.338c.085-.628.677-1.686 1.588-2.065.013-.07.024-.143.036-.218.029-.183.06-.384.126-.612-.201-.508-.254-1.084-.254-1.656 0-.87.128-1.769.693-2.484.579-.733 1.494-1.124 2.724-1.261 1.206-.134 2.262.034 2.944.765.05.053.096.108.139.165.044-.057.094-.112.143-.165.682-.731 1.738-.899 2.944-.765 1.23.137 2.145.528 2.724 1.261.566.715.693 1.614.693 2.484 0 .572-.053 1.148-.254 1.656.066.228.098.429.126.612.012.076.024.148.037.218.924.385 1.522 1.471 1.591 2.095v1.872c0 .766-3.351 3.795-8.002 3.795Zm0-1.485c2.28 0 4.584-1.11 5.002-1.433V7.862l-.023-.116c-.49.21-1.075.291-1.727.291-1.146 0-2.059-.327-2.71-.991A3.222 3.222 0 0 1 8 6.303a3.24 3.24 0 0 1-.544.743c-.65.664-1.563.991-2.71.991-.652 0-1.236-.081-1.727-.291l-.023.116v4.255c.419.323 2.722 1.433 5.002 1.433ZM6.762 2.83c-.193-.206-.637-.413-1.682-.297-1.019.113-1.479.404-1.713.7-.247.312-.369.789-.369 1.554 0 .793.129 1.171.308 1.371.162.181.519.379 1.442.379.853 0 1.339-.235 1.638-.54.315-.322.527-.827.617-1.553.117-.935-.037-1.395-.241-1.614Zm4.155-.297c-1.044-.116-1.488.091-1.681.297-.204.219-.359.679-.242 1.614.091.726.303 1.231.618 1.553.299.305.784.54 1.638.54.922 0 1.28-.198 1.442-.379.179-.2.308-.578.308-1.371 0-.765-.123-1.242-.37-1.554-.233-.296-.693-.587-1.713-.7Z"></path><path d="M6.25 9.037a.75.75 0 0 1 .75.75v1.501a.75.75 0 0 1-1.5 0V9.787a.75.75 0 0 1 .75-.75Zm4.25.75v1.501a.75.75 0 0 1-1.5 0V9.787a.75.75 0 0 1 1.5 0Z"></path></svg>Copilot for Business</span><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS NavLink-module__subtitle__X4gkW">Enterprise-grade AI features</span></span></a></li><li><a class="Primer_Brand__Link-module__Link___lF11y Primer_Brand__Link-module__Link--default___VRVW0 NavLink-module__link__EG3d4" href="https://github.com/enterprise/premium-support" data-analytics-event="{&quot;action&quot;:&quot;premium_support&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;enterprise&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;premium_support_link_enterprise_navbar&quot;}"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Link-module__Link--label___jM8Ty"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS Primer_Brand__Text-module__Text--weight-medium___qJKf_ NavLink-module__title__Q7t0p"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-comment-discussion NavLink-module__icon__ltGNM" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M1.75 1h8.5c.966 0 1.75.784 1.75 1.75v5.5A1.75 1.75 0 0 1 10.25 10H7.061l-2.574 2.573A1.458 1.458 0 0 1 2 11.543V10h-.25A1.75 1.75 0 0 1 0 8.25v-5.5C0 1.784.784 1 1.75 1ZM1.5 2.75v5.5c0 .138.112.25.25.25h1a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h3.5a.25.25 0 0 0 .25-.25v-5.5a.25.25 0 0 0-.25-.25h-8.5a.25.25 0 0 0-.25.25Zm13 2a.25.25 0 0 0-.25-.25h-.5a.75.75 0 0 1 0-1.5h.5c.966 0 1.75.784 1.75 1.75v5.5A1.75 1.75 0 0 1 14.25 12H14v1.543a1.458 1.458 0 0 1-2.487 1.03L9.22 12.28a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215l2.22 2.22v-2.19a.75.75 0 0 1 .75-.75h1a.25.25 0 0 0 .25-.25Z"></path></svg>Premium Support</span><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--muted___rE6mh Primer_Brand__Text-module__Text--200____P1wy Primer_Brand__Text-module__Text--antialiased___TYoXS NavLink-module__subtitle__X4gkW">Enterprise-grade 24/7 support</span></span></a></li></ul></div></li></ul></div></div></li><li><a href="https://github.com/pricing" data-analytics-event="{&quot;action&quot;:&quot;pricing&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;pricing&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;pricing_link_pricing_navbar&quot;}" class="MarketingNavigation-module__navLink__hUomM">Pricing</a></li></ul></nav><div class="MarketingHeader-module__ctaContainer__tBmPz"><div class="HeaderSearch-module__searchSlot__oVOUS"><button class="Primer_Brand__Button-module__Button___scH9Z Primer_Brand__Button-module__Button--subtle___F7pEE Primer_Brand__Button-module__Button--size-small___zQrEw HeaderSearch-module__trigger__zsF9q" type="button" aria-haspopup="dialog" aria-expanded="false" aria-label="Search or jump to, type / to search" data-analytics-event="{&quot;action&quot;:&quot;searchbar&quot;,&quot;tag&quot;:&quot;input&quot;,&quot;context&quot;:&quot;global&quot;,&quot;location&quot;:&quot;navbar&quot;,&quot;label&quot;:&quot;searchbar_input_global_navbar&quot;}"><span class="Primer_Brand__Button-module__Button__text___ED0bX"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--100___B2ueX Primer_Brand__Text-module__Text--weight-medium___qJKf_ Primer_Brand__Button-module__Button--label___qrkyz Primer_Brand__Button-module__Button--label-subtle___8ndWH"><span class="HeaderSearch-module__content__kMpxU"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-search HeaderSearch-module__icon__wcrHX" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg><span class="HeaderSearch-module__label__d1iWG">Search</span><kbd class="HeaderSearch-module__kbd__HNG0o" aria-hidden="true">/</kbd></span></span></span></button><div class="d-none"></div></div><div class="AuthCTAs-module__signInWrap__q2P60"><a class="Primer_Brand__Button-module__Button___scH9Z Primer_Brand__Button-module__Button--subtle___F7pEE Primer_Brand__Button-module__Button--size-small___zQrEw AuthCTAs-module__cta__WpwQq AuthCTAs-module__desktopActionGap__UZuXT AuthCTAs-module__hiddenBelowLg__BfKBw" href="/login?return_to=https%3A%2F%2Fgithub.com%2Ffeinan%2Fleetcode-master%2Fblob%2Fmaster%2Fproblems%2F1047.%25E5%2588%25A0%25E9%2599%25A4%25E5%25AD%2597%25E7%25AC%25A6%25E4%25B8%25B2%25E4%25B8%25AD%25E7%259A%2584%25E6%2589%2580%25E6%259C%2589%25E7%259B%25B8%25E9%2582%25BB%25E9%2587%258D%25E5%25A4%258D%25E9%25A1%25B9.md" data-analytics-event="{&quot;action&quot;:&quot;sign_in&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;auth_cta&quot;,&quot;location&quot;:&quot;header&quot;,&quot;label&quot;:&quot;sign_in_link_auth_cta_header&quot;}" data-hydro-click="{&quot;event_type&quot;:&quot;authentication.click&quot;,&quot;payload&quot;:{&quot;location_in_page&quot;:&quot;site header menu&quot;,&quot;repository_id&quot;:null,&quot;auth_type&quot;:&quot;SIGN_UP&quot;,&quot;originating_url&quot;:&quot;https://github.com/feinan/leetcode-master/blob/master/problems/1047.%E5%88%A0%E9%99%A4%E5%AD%97%E7%AC%A6%E4%B8%B2%E4%B8%AD%E7%9A%84%E6%89%80%E6%9C%89%E7%9B%B8%E9%82%BB%E9%87%8D%E5%A4%8D%E9%A1%B9.md&quot;,&quot;user_id&quot;:null}}" data-hydro-click-hmac="72aabcab98031ef0f02f070b427e560e754461ebe59feef6a26ab6282ff4bfc2"><span class="Primer_Brand__Button-module__Button__text___ED0bX"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--100___B2ueX Primer_Brand__Text-module__Text--weight-medium___qJKf_ Primer_Brand__Button-module__Button--label___qrkyz Primer_Brand__Button-module__Button--label-subtle___8ndWH">Sign in</span></span></a></div><a class="Primer_Brand__Button-module__Button___scH9Z Primer_Brand__Button-module__Button--secondary___gHnw_ Primer_Brand__Button-module__Button--size-small___zQrEw AuthCTAs-module__cta__WpwQq" href="/signup?ref_cta=Sign+up&amp;ref_loc=header+logged+out&amp;ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fblob%2Fshow&amp;source=header-repo&amp;source_repo=feinan%2Fleetcode-master" data-analytics-event="{&quot;action&quot;:&quot;sign_up&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;context&quot;:&quot;auth_cta&quot;,&quot;location&quot;:&quot;header&quot;,&quot;label&quot;:&quot;sign_up_link_auth_cta_header&quot;}" data-hydro-click="{&quot;event_type&quot;:&quot;authentication.click&quot;,&quot;payload&quot;:{&quot;location_in_page&quot;:&quot;site header menu&quot;,&quot;repository_id&quot;:null,&quot;auth_type&quot;:&quot;SIGN_UP&quot;,&quot;originating_url&quot;:&quot;https://github.com/feinan/leetcode-master/blob/master/problems/1047.%E5%88%A0%E9%99%A4%E5%AD%97%E7%AC%A6%E4%B8%B2%E4%B8%AD%E7%9A%84%E6%89%80%E6%9C%89%E7%9B%B8%E9%82%BB%E9%87%8D%E5%A4%8D%E9%A1%B9.md&quot;,&quot;user_id&quot;:null}}" data-hydro-click-hmac="72aabcab98031ef0f02f070b427e560e754461ebe59feef6a26ab6282ff4bfc2"><span class="Primer_Brand__Button-module__Button__text___ED0bX"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--100___B2ueX Primer_Brand__Text-module__Text--weight-medium___qJKf_ Primer_Brand__Button-module__Button--label___qrkyz Primer_Brand__Button-module__Button--label-secondary___eJ0_a">Sign up</span></span></a><button class="Primer_Brand__Button-module__Button___scH9Z Primer_Brand__Button-module__Button--subtle___F7pEE Primer_Brand__Button-module__Button--size-small___zQrEw HeaderAppearanceSettings-module__trigger__hUheK" type="button" aria-haspopup="dialog" aria-labelledby="_R_fbd_"><span class="Primer_Brand__Button-module__Button__leading-visual___jjtTe" data-testid="Button-leading-visual"><svg data-component="Octicon" focusable="false" aria-hidden="true" class="octicon octicon-sliders Primer_Brand__Button-module__Button__icon-visual____qybb" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M15 2.75a.75.75 0 0 1-.75.75h-4a.75.75 0 0 1 0-1.5h4a.75.75 0 0 1 .75.75Zm-8.5.75v1.25a.75.75 0 0 0 1.5 0v-4a.75.75 0 0 0-1.5 0V2H1.75a.75.75 0 0 0 0 1.5H6.5Zm1.25 5.25a.75.75 0 0 0 0-1.5h-6a.75.75 0 0 0 0 1.5h6ZM15 8a.75.75 0 0 1-.75.75H11.5V10a.75.75 0 1 1-1.5 0V6a.75.75 0 0 1 1.5 0v1.25h2.75A.75.75 0 0 1 15 8Zm-9 5.25v-2a.75.75 0 0 0-1.5 0v1.25H1.75a.75.75 0 0 0 0 1.5H4.5v1.25a.75.75 0 0 0 1.5 0v-2Zm9 0a.75.75 0 0 1-.75.75h-6a.75.75 0 0 1 0-1.5h6a.75.75 0 0 1 .75.75Z"></path></svg></span><span class="Primer_Brand__Button-module__Button__text___ED0bX"><span class="Primer_Brand__Text-module__Text___XeGJJ Primer_Brand__Text-module__Text-font--mona-sans___a8XJD Primer_Brand__Text-module__Text--default___GhPh_ Primer_Brand__Text-module__Text--100___B2ueX Primer_Brand__Text-module__Text--weight-medium___qJKf_ Primer_Brand__Button-module__Button--label___qrkyz Primer_Brand__Button-module__Button--label-subtle___8ndWH"></span></span></button><div class="Primer_Brand__Tooltip-module__Tooltip___0Eipx" data-direction="s" aria-hidden="true" id="_R_fbd_">Appearance settings</div></div></div></div></div><div class="MarketingHeader-module__bottomBorder__uZT38" aria-hidden="true"></div></header></div></div>
</react-partial>



      <div hidden="hidden" data-view-component="true" class="js-stale-session-flash stale-session-flash flash flash-warn flash-full">
  
        <svg aria-hidden="true" data-component="Octicon" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-alert">
    <path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path>
</svg>
        <span class="js-stale-session-flash-signed-in" hidden>You signed in with another tab or window. <a class="Link--inTextBlock" href="">Reload</a> to refresh your session.</span>
        <span class="js-stale-session-flash-signed-out" hidden>You signed out in another tab or window. <a class="Link--inTextBlock" href="">Reload</a> to refresh your session.</span>
        <span class="js-stale-session-flash-switched" hidden>You switched accounts on another tab or window. <a class="Link--inTextBlock" href="">Reload</a> to refresh your session.</span>

    <button id="icon-button-bad59b33-a020-45da-9118-2897a0d4be7e" aria-labelledby="tooltip-b476961d-e051-4d2a-ab6e-c63a1cc164b3" type="button" data-view-component="true" class="Button Button--iconOnly Button--invisible Button--medium flash-close js-flash-close">  <svg aria-hidden="true" data-component="Octicon" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x Button-visual">
    <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path>
</svg>
</button><tool-tip id="tooltip-b476961d-e051-4d2a-ab6e-c63a1cc164b3" for="icon-button-bad59b33-a020-45da-9118-2897a0d4be7e" popover="manual" data-direction="s" data-type="label" data-view-component="true" class="sr-only position-absolute">Dismiss alert</tool-tip>


  
</div>
    </div>

  <div id="start-of-content" class="show-on-focus"></div>








    <div id="js-flash-container" class="flash-container" data-turbo-replace>





  <template class="js-flash-template">
    
<div class="flash flash-full   {{ className }}">
  <div >
    <button autofocus class="flash-close js-flash-close" type="button" aria-label="Dismiss this message">
      <svg aria-hidden="true" data-component="Octicon" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x">
    <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path>
</svg>
    </button>
    <div aria-atomic="true" role="alert" class="js-flash-alert">
      
      <div>{{ message }}</div>

    </div>
  </div>
</div>
  </template>
</div>


    






  <div
    class="application-main "
    data-commit-hovercards-enabled
    data-discussion-hovercards-enabled
    data-issue-and-pr-hovercards-enabled
    data-project-hovercards-enabled
  >
        <div itemscope itemtype="http://schema.org/SoftwareSourceCode" class="">
    <main id="js-repo-pjax-container" >
      
      








  

    <div id="repository-container-header"  class="tmp-pt-3 hide-full-screen" style="background-color: var(--page-header-bgColor, var(--color-page-header-bg));" data-turbo-replace>

        <div class="d-flex flex-nowrap flex-justify-end tmp-mb-3  tmp-px-3 tmp-px-lg-5" style="gap: 1rem;">

          <div class="flex-auto min-width-0 width-fit">
              
  <div class=" d-flex flex-wrap flex-items-center wb-break-word f3 text-normal">
      <svg aria-hidden="true" data-component="Octicon" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo-forked color-fg-muted mr-2 tmp-mr-2">
    <path d="M5 5.372v.878c0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75v-.878a2.25 2.25 0 1 1 1.5 0v.878a2.25 2.25 0 0 1-2.25 2.25h-1.5v2.128a2.251 2.251 0 1 1-1.5 0V8.5h-1.5A2.25 2.25 0 0 1 3.5 6.25v-.878a2.25 2.25 0 1 1 1.5 0ZM5 3.25a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Zm6.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Zm-3 8.75a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Z"></path>
</svg>
    
    <span class="author flex-self-stretch" itemprop="author">
      <a class="url fn" rel="author" data-hovercard-type="user" data-hovercard-url="/users/feinan/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="/feinan">
        feinan
</a>    </span>
    <span class="mx-1 flex-self-stretch color-fg-muted">/</span>
    <strong itemprop="name" class="mr-2 flex-self-stretch">
      <a data-pjax="#repo-content-pjax-container" data-turbo-frame="repo-content-turbo-frame" href="/feinan/leetcode-master">leetcode-master</a>
    </strong>

    <span></span><span class="Label Label--secondary v-align-middle mr-1">Public</span>
  </div>
    <span class="text-small lh-condensed-ultra no-wrap mt-1" data-repository-hovercards-enabled>
      forked from <a data-hovercard-type="repository" data-hovercard-url="/youngyangyang04/leetcode-master/hovercard" class="Link--inTextBlock" href="/youngyangyang04/leetcode-master">youngyangyang04/leetcode-master</a>
    </span>


          </div>

          <div id="repository-details-container" class="flex-shrink-0" data-turbo-replace style="max-width: 70%;">
              <ul class="pagehead-actions flex-shrink-0 d-none d-md-inline" style="padding: 2px 0;">
    
      

  <li>
            <a href="/login?return_to=%2Ffeinan%2Fleetcode-master" rel="nofollow" id="repository-details-watch-button" data-hydro-click="{&quot;event_type&quot;:&quot;authentication.click&quot;,&quot;payload&quot;:{&quot;location_in_page&quot;:&quot;notification subscription menu watch&quot;,&quot;repository_id&quot;:null,&quot;auth_type&quot;:&quot;LOG_IN&quot;,&quot;originating_url&quot;:&quot;https://github.com/feinan/leetcode-master/blob/master/problems/1047.%E5%88%A0%E9%99%A4%E5%AD%97%E7%AC%A6%E4%B8%B2%E4%B8%AD%E7%9A%84%E6%89%80%E6%9C%89%E7%9B%B8%E9%82%BB%E9%87%8D%E5%A4%8D%E9%A1%B9.md&quot;,&quot;user_id&quot;:null}}" data-hydro-click-hmac="5bfd94c808d4fae8971a82a09b43c95b5a9c4cd695772f43140c6a9da8f64853" aria-label="You must be signed in to change notification settings" data-view-component="true" class="btn-sm btn">    <svg aria-hidden="true" data-component="Octicon" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-bell mr-2 tmp-mr-2">
    <path d="M8 16a2 2 0 0 0 1.985-1.75c.017-.137-.097-.25-.235-.25h-3.5c-.138 0-.252.113-.235.25A2 2 0 0 0 8 16ZM3 5a5 5 0 0 1 10 0v2.947c0 .05.015.098.042.139l1.703 2.555A1.519 1.519 0 0 1 13.482 13H2.518a1.516 1.516 0 0 1-1.263-2.36l1.703-2.554A.255.255 0 0 0 3 7.947Zm5-3.5A3.5 3.5 0 0 0 4.5 5v2.947c0 .346-.102.683-.294.97l-1.703 2.556a.017.017 0 0 0-.003.01l.001.006c0 .002.002.004.004.006l.006.004.007.001h10.964l.007-.001.006-.004.004-.006.001-.007a.017.017 0 0 0-.003-.01l-1.703-2.554a1.745 1.745 0 0 1-.294-.97V5A3.5 3.5 0 0 0 8 1.5Z"></path>
</svg>Notifications
</a>    <tool-tip id="tooltip-72455db7-5f5d-488b-987c-afb4983662fc" for="repository-details-watch-button" popover="manual" data-direction="s" data-type="description" data-view-component="true" class="sr-only position-absolute">You must be signed in to change notification settings</tool-tip>

  </li>

  <li>
          <a icon="repo-forked" id="fork-button" href="/login?return_to=%2Ffeinan%2Fleetcode-master" rel="nofollow" data-hydro-click="{&quot;event_type&quot;:&quot;authentication.click&quot;,&quot;payload&quot;:{&quot;location_in_page&quot;:&quot;repo details fork button&quot;,&quot;repository_id&quot;:793905675,&quot;auth_type&quot;:&quot;LOG_IN&quot;,&quot;originating_url&quot;:&quot;https://github.com/feinan/leetcode-master/blob/master/problems/1047.%E5%88%A0%E9%99%A4%E5%AD%97%E7%AC%A6%E4%B8%B2%E4%B8%AD%E7%9A%84%E6%89%80%E6%9C%89%E7%9B%B8%E9%82%BB%E9%87%8D%E5%A4%8D%E9%A1%B9.md&quot;,&quot;user_id&quot;:null}}" data-hydro-click-hmac="75de92224d2ac5045d7c7708de1fc3a37ad8ee57e4db9e9ab21a6c9b91d4b718" data-view-component="true" class="btn-sm btn">    <svg aria-hidden="true" data-component="Octicon" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo-forked mr-2 tmp-mr-2">
    <path d="M5 5.372v.878c0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75v-.878a2.25 2.25 0 1 1 1.5 0v.878a2.25 2.25 0 0 1-2.25 2.25h-1.5v2.128a2.251 2.251 0 1 1-1.5 0V8.5h-1.5A2.25 2.25 0 0 1 3.5 6.25v-.878a2.25 2.25 0 1 1 1.5 0ZM5 3.25a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Zm6.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Zm-3 8.75a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Z"></path>
</svg>Fork
    <span id="repo-network-counter" data-pjax-replace="true" data-turbo-replace="true" title="4" data-view-component="true" class="Counter">4</span>
</a>
  </li>

  <li>
        <div data-view-component="true" class="BtnGroup d-flex">
        <a href="/login?return_to=%2Ffeinan%2Fleetcode-master" rel="nofollow" data-hydro-click="{&quot;event_type&quot;:&quot;authentication.click&quot;,&quot;payload&quot;:{&quot;location_in_page&quot;:&quot;star button&quot;,&quot;repository_id&quot;:793905675,&quot;auth_type&quot;:&quot;LOG_IN&quot;,&quot;originating_url&quot;:&quot;https://github.com/feinan/leetcode-master/blob/master/problems/1047.%E5%88%A0%E9%99%A4%E5%AD%97%E7%AC%A6%E4%B8%B2%E4%B8%AD%E7%9A%84%E6%89%80%E6%9C%89%E7%9B%B8%E9%82%BB%E9%87%8D%E5%A4%8D%E9%A1%B9.md&quot;,&quot;user_id&quot;:null}}" data-hydro-click-hmac="a1c1fbac904d4896ad8b1a583bffe2ebaa3e338d8ff47cce33b08bf360a1618e" aria-label="You must be signed in to star a repository" data-view-component="true" class="tooltipped tooltipped-sw btn-sm btn">    <svg aria-hidden="true" data-component="Octicon" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-star v-align-text-bottom d-inline-block mr-2 tmp-mr-2">
    <path d="M8 .25a.75.75 0 0 1 .673.418l1.882 3.815 4.21.612a.75.75 0 0 1 .416 1.279l-3.046 2.97.719 4.192a.751.751 0 0 1-1.088.791L8 12.347l-3.766 1.98a.75.75 0 0 1-1.088-.79l.72-4.194L.818 6.374a.75.75 0 0 1 .416-1.28l4.21-.611L7.327.668A.75.75 0 0 1 8 .25Zm0 2.445L6.615 5.5a.75.75 0 0 1-.564.41l-3.097.45 2.24 2.184a.75.75 0 0 1 .216.664l-.528 3.084 2.769-1.456a.75.75 0 0 1 .698 0l2.77 1.456-.53-3.084a.75.75 0 0 1 .216-.664l2.24-2.183-3.096-.45a.75.75 0 0 1-.564-.41L8 2.694Z"></path>
</svg><span data-view-component="true" class="d-inline">
          Star
</span>          <span id="repo-stars-counter-star" aria-label="3 users starred this repository" data-singular-suffix="user starred this repository" data-plural-suffix="users starred this repository" data-turbo-replace="true" title="3" data-view-component="true" class="Counter js-social-count">3</span>
</a></div>
  </li>

</ul>

          </div>
        </div>

          <div id="responsive-meta-container" data-turbo-replace>
</div>


            <nav data-pjax="#js-repo-pjax-container" aria-label="Repository" data-view-component="true" class="js-repo-nav js-sidenav-container-pjax js-responsive-underlinenav overflow-hidden UnderlineNav px-3 tmp-px-3 px-md-4 tmp-px-md-4 px-lg-5 tmp-px-lg-5">

  <ul data-view-component="true" class="UnderlineNav-body list-style-none">
      <li data-view-component="true" class="d-inline-flex">
  <a id="code-tab" href="/feinan/leetcode-master" data-tab-item="i0code-tab" data-selected-links="repo_source repo_downloads repo_commits repo_releases repo_tags repo_branches repo_packages repo_deployments repo_attestations /feinan/leetcode-master" data-pjax="#repo-content-pjax-container" data-turbo-frame="repo-content-turbo-frame" data-hotkey="g c" data-command-id="repositories:go-to-code" data-react-nav="code-view" data-react-nav-anchor="code-view-repo-link" data-analytics-event="{&quot;category&quot;:&quot;Underline navbar&quot;,&quot;action&quot;:&quot;Click tab&quot;,&quot;label&quot;:&quot;Code&quot;,&quot;target&quot;:&quot;UNDERLINE_NAV.TAB&quot;}" aria-current="page" data-view-component="true" class="UnderlineNav-item no-wrap js-responsive-underlinenav-item js-selected-navigation-item selected">
    
              <svg aria-hidden="true" data-component="Octicon" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-code UnderlineNav-octicon d-none d-sm-inline">
    <path d="m11.28 3.22 4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734L13.94 8l-3.72-3.72a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215Zm-6.56 0a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042L2.06 8l3.72 3.72a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L.47 8.53a.75.75 0 0 1 0-1.06Z"></path>
</svg>
        <span data-content="Code">Code</span>
          <span id="code-repo-tab-count" data-pjax-replace="" data-turbo-replace="" title="Not available" data-view-component="true" class="Counter"></span>


    
</a></li>
      <li data-view-component="true" class="d-inline-flex">
  <a id="pull-requests-tab" href="/feinan/leetcode-master/pulls" data-tab-item="i1pull-requests-tab" data-selected-links="repo_pulls checks /feinan/leetcode-master/pulls" data-pjax="#repo-content-pjax-container" data-turbo-frame="repo-content-turbo-frame" data-hotkey="g p" data-command-id="repositories:go-to-pull-requests" data-analytics-event="{&quot;category&quot;:&quot;Underline navbar&quot;,&quot;action&quot;:&quot;Click tab&quot;,&quot;label&quot;:&quot;Pull requests&quot;,&quot;target&quot;:&quot;UNDERLINE_NAV.TAB&quot;}" data-view-component="true" class="UnderlineNav-item no-wrap js-responsive-underlinenav-item js-selected-navigation-item">
    
              <svg aria-hidden="true" data-component="Octicon" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-git-pull-request UnderlineNav-octicon d-none d-sm-inline">
    <path d="M1.5 3.25a2.25 2.25 0 1 1 3 2.122v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.25 2.25 0 0 1 1.5 3.25Zm5.677-.177L9.573.677A.25.25 0 0 1 10 .854V2.5h1A2.5 2.5 0 0 1 13.5 5v5.628a2.251 2.251 0 1 1-1.5 0V5a1 1 0 0 0-1-1h-1v1.646a.25.25 0 0 1-.427.177L7.177 3.427a.25.25 0 0 1 0-.354ZM3.75 2.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm0 9.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm8.25.75a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Z"></path>
</svg>
        <span data-content="Pull requests">Pull requests</span>
          <span id="pull-requests-repo-tab-count" data-pjax-replace="" data-turbo-replace="" title="0" hidden="hidden" data-view-component="true" class="Counter">0</span>


    
</a></li>
      <li data-view-component="true" class="d-inline-flex">
  <a id="actions-tab" href="/feinan/leetcode-master/actions" data-tab-item="i2actions-tab" data-selected-links="repo_actions /feinan/leetcode-master/actions" data-pjax="#repo-content-pjax-container" data-turbo-frame="repo-content-turbo-frame" data-hotkey="g a" data-command-id="repositories:go-to-actions" data-react-nav="actions-workflows" data-analytics-event="{&quot;category&quot;:&quot;Underline navbar&quot;,&quot;action&quot;:&quot;Click tab&quot;,&quot;label&quot;:&quot;Actions&quot;,&quot;target&quot;:&quot;UNDERLINE_NAV.TAB&quot;}" data-view-component="true" class="UnderlineNav-item no-wrap js-responsive-underlinenav-item js-selected-navigation-item">
    
              <svg aria-hidden="true" data-component="Octicon" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-play UnderlineNav-octicon d-none d-sm-inline">
    <path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm4.879-2.773 4.264 2.559a.25.25 0 0 1 0 .428l-4.264 2.559A.25.25 0 0 1 6 10.559V5.442a.25.25 0 0 1 .379-.215Z"></path>
</svg>
        <span data-content="Actions">Actions</span>
          <span id="actions-repo-tab-count" data-pjax-replace="" data-turbo-replace="" title="Not available" data-view-component="true" class="Counter"></span>


    
</a></li>
      <li data-view-component="true" class="d-inline-flex">
  <a id="projects-tab" href="/feinan/leetcode-master/projects" data-tab-item="i3projects-tab" data-selected-links="repo_projects new_repo_project repo_project /feinan/leetcode-master/projects" data-pjax="#repo-content-pjax-container" data-turbo-frame="repo-content-turbo-frame" data-hotkey="g b" data-command-id="repositories:go-to-projects" data-react-nav="repo" data-analytics-event="{&quot;category&quot;:&quot;Underline navbar&quot;,&quot;action&quot;:&quot;Click tab&quot;,&quot;label&quot;:&quot;Projects&quot;,&quot;target&quot;:&quot;UNDERLINE_NAV.TAB&quot;}" data-view-component="true" class="UnderlineNav-item no-wrap js-responsive-underlinenav-item js-selected-navigation-item">
    
              <svg aria-hidden="true" data-component="Octicon" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-table UnderlineNav-octicon d-none d-sm-inline">
    <path d="M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25ZM6.5 6.5v8h7.75a.25.25 0 0 0 .25-.25V6.5Zm8-1.5V1.75a.25.25 0 0 0-.25-.25H6.5V5Zm-13 1.5v7.75c0 .138.112.25.25.25H5v-8ZM5 5V1.5H1.75a.25.25 0 0 0-.25.25V5Z"></path>
</svg>
        <span data-content="Projects">Projects</span>
          <span id="projects-repo-tab-count" data-pjax-replace="" data-turbo-replace="" title="Not available" data-view-component="true" class="Counter"></span>


    
</a></li>
      <li data-view-component="true" class="d-inline-flex">
  <a id="security-and-quality-tab" href="/feinan/leetcode-master/security" data-tab-item="i4security-and-quality-tab" data-selected-links="security overview alerts policy token_scanning code_scanning /feinan/leetcode-master/security" data-pjax="#repo-content-pjax-container" data-turbo-frame="repo-content-turbo-frame" data-hotkey="g s" data-command-id="repositories:go-to-security" data-analytics-event="{&quot;category&quot;:&quot;Underline navbar&quot;,&quot;action&quot;:&quot;Click tab&quot;,&quot;label&quot;:&quot;Security and quality&quot;,&quot;target&quot;:&quot;UNDERLINE_NAV.TAB&quot;}" data-view-component="true" class="UnderlineNav-item no-wrap js-responsive-underlinenav-item js-selected-navigation-item">
    
              <svg aria-hidden="true" data-component="Octicon" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-shield UnderlineNav-octicon d-none d-sm-inline">
    <path d="M7.467.133a1.748 1.748 0 0 1 1.066 0l5.25 1.68A1.75 1.75 0 0 1 15 3.48V7c0 1.566-.32 3.182-1.303 4.682-.983 1.498-2.585 2.813-5.032 3.855a1.697 1.697 0 0 1-1.33 0c-2.447-1.042-4.049-2.357-5.032-3.855C1.32 10.182 1 8.566 1 7V3.48a1.75 1.75 0 0 1 1.217-1.667Zm.61 1.429a.25.25 0 0 0-.153 0l-5.25 1.68a.25.25 0 0 0-.174.238V7c0 1.358.275 2.666 1.057 3.86.784 1.194 2.121 2.34 4.366 3.297a.196.196 0 0 0 .154 0c2.245-.956 3.582-2.104 4.366-3.298C13.225 9.666 13.5 8.36 13.5 7V3.48a.251.251 0 0 0-.174-.237l-5.25-1.68ZM8.75 4.75v3a.75.75 0 0 1-1.5 0v-3a.75.75 0 0 1 1.5 0ZM9 10.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path>
</svg>
        <span data-content="Security and quality">Security and quality</span>
          <span id="security-and-quality-repo-tab-count" data-pjax-replace="" data-turbo-replace="" title="0" hidden="hidden" data-view-component="true" class="Counter">0</span>


    
</a></li>
      <li data-view-component="true" class="d-inline-flex">
  <a id="insights-tab" href="/feinan/leetcode-master/pulse" data-tab-item="i5insights-tab" data-selected-links="repo_graphs repo_contributors dependency_graph dependabot_updates pulse people community /feinan/leetcode-master/pulse" data-pjax="#repo-content-pjax-container" data-turbo-frame="repo-content-turbo-frame" data-command-id="repositories:go-to-insights" data-analytics-event="{&quot;category&quot;:&quot;Underline navbar&quot;,&quot;action&quot;:&quot;Click tab&quot;,&quot;label&quot;:&quot;Insights&quot;,&quot;target&quot;:&quot;UNDERLINE_NAV.TAB&quot;}" data-view-component="true" class="UnderlineNav-item no-wrap js-responsive-underlinenav-item js-selected-navigation-item">
    
              <svg aria-hidden="true" data-component="Octicon" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-graph UnderlineNav-octicon d-none d-sm-inline">
    <path d="M1.5 1.75V13.5h13.75a.75.75 0 0 1 0 1.5H.75a.75.75 0 0 1-.75-.75V1.75a.75.75 0 0 1 1.5 0Zm14.28 2.53-5.25 5.25a.75.75 0 0 1-1.06 0L7 7.06 4.28 9.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.25-3.25a.75.75 0 0 1 1.06 0L10 7.94l4.72-4.72a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042Z"></path>
</svg>
        <span data-content="Insights">Insights</span>
          <span id="insights-repo-tab-count" data-pjax-replace="" data-turbo-replace="" title="Not available" data-view-component="true" class="Counter"></span>


    
</a></li>
</ul>
    <div style="visibility:hidden;" data-view-component="true" class="UnderlineNav-actions js-responsive-underlinenav-overflow position-absolute pr-3 tmp-pr-3 pr-md-4 tmp-pr-md-4 pr-lg-5 tmp-pr-lg-5 right-0">      <action-menu data-select-variant="none" data-view-component="true">
  <focus-group direction="vertical" mnemonics retain>
    <button id="action-menu-000647ef-560c-480d-ac63-136250dce84a-button" popovertarget="action-menu-000647ef-560c-480d-ac63-136250dce84a-overlay" aria-controls="action-menu-000647ef-560c-480d-ac63-136250dce84a-list" aria-haspopup="true" aria-labelledby="tooltip-66115d4d-32f7-4dad-b4fa-37c389cbef79" type="button" data-view-component="true" class="Button Button--iconOnly Button--secondary Button--medium UnderlineNav-item">  <svg aria-hidden="true" data-component="Octicon" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-kebab-horizontal Button-visual">
    <path d="M8 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3ZM1.5 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm13 0a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path>
</svg>
</button><tool-tip id="tooltip-66115d4d-32f7-4dad-b4fa-37c389cbef79" for="action-menu-000647ef-560c-480d-ac63-136250dce84a-button" popover="manual" data-direction="s" data-type="label" data-view-component="true" class="sr-only position-absolute">Additional navigation options</tool-tip>


<anchored-position data-target="action-menu.overlay" id="action-menu-000647ef-560c-480d-ac63-136250dce84a-overlay" anchor="action-menu-000647ef-560c-480d-ac63-136250dce84a-button" align="start" side="outside-bottom" anchor-offset="normal" popover="auto" data-view-component="true">
  <div data-view-component="true" class="Overlay Overlay--size-auto">
    
      <div data-view-component="true" class="Overlay-body Overlay-body--paddingNone">          <action-list>
  <div data-view-component="true">
    <ul aria-labelledby="action-menu-000647ef-560c-480d-ac63-136250dce84a-button" id="action-menu-000647ef-560c-480d-ac63-136250dce84a-list" role="menu" data-view-component="true" class="ActionListWrap--inset ActionListWrap">
        <li hidden="hidden" data-menu-item="i0code-tab" data-targets="action-list.items" role="none" data-view-component="true" class="ActionListItem">
    
    
    <a tabindex="-1" id="item-10b2e288-641b-439a-9442-1fe0baf25b65" href="/feinan/leetcode-master" role="menuitem" data-view-component="true" class="ActionListContent ActionListContent--visual16">
        <span class="ActionListItem-visual ActionListItem-visual--leading">
          <svg aria-hidden="true" data-component="Octicon" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-code">
    <path d="m11.28 3.22 4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734L13.94 8l-3.72-3.72a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215Zm-6.56 0a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042L2.06 8l3.72 3.72a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L.47 8.53a.75.75 0 0 1 0-1.06Z"></path>
</svg>
        </span>
      
        <span data-view-component="true" class="ActionListItem-label">
          Code
</span>      
</a>
  
</li>
        <li hidden="hidden" data-menu-item="i1pull-requests-tab" data-targets="action-list.items" role="none" data-view-component="true" class="ActionListItem">
    
    
    <a tabindex="-1" id="item-2d1d3ce7-d673-4174-8847-9373fc2e46fe" href="/feinan/leetcode-master/pulls" role="menuitem" data-view-component="true" class="ActionListContent ActionListContent--visual16">
        <span class="ActionListItem-visual ActionListItem-visual--leading">
          <svg aria-hidden="true" data-component="Octicon" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-git-pull-request">
    <path d="M1.5 3.25a2.25 2.25 0 1 1 3 2.122v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.25 2.25 0 0 1 1.5 3.25Zm5.677-.177L9.573.677A.25.25 0 0 1 10 .854V2.5h1A2.5 2.5 0 0 1 13.5 5v5.628a2.251 2.251 0 1 1-1.5 0V5a1 1 0 0 0-1-1h-1v1.646a.25.25 0 0 1-.427.177L7.177 3.427a.25.25 0 0 1 0-.354ZM3.75 2.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm0 9.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm8.25.75a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Z"></path>
</svg>
        </span>
      
        <span data-view-component="true" class="ActionListItem-label">
          Pull requests
</span>      
</a>
  
</li>
        <li hidden="hidden" data-menu-item="i2actions-tab" data-targets="action-list.items" role="none" data-view-component="true" class="ActionListItem">
    
    
    <a tabindex="-1" id="item-d2e673f3-7d43-4b90-ac24-c8d3d29666a2" href="/feinan/leetcode-master/actions" role="menuitem" data-view-component="true" class="ActionListContent ActionListContent--visual16">
        <span class="ActionListItem-visual ActionListItem-visual--leading">
          <svg aria-hidden="true" data-component="Octicon" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-play">
    <path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm4.879-2.773 4.264 2.559a.25.25 0 0 1 0 .428l-4.264 2.559A.25.25 0 0 1 6 10.559V5.442a.25.25 0 0 1 .379-.215Z"></path>
</svg>
        </span>
      
        <span data-view-component="true" class="ActionListItem-label">
          Actions
</span>      
</a>
  
</li>
        <li hidden="hidden" data-menu-item="i3projects-tab" data-targets="action-list.items" role="none" data-view-component="true" class="ActionListItem">
    
    
    <a tabindex="-1" id="item-a2827189-3cf5-4412-a039-c5ec86d69100" href="/feinan/leetcode-master/projects" role="menuitem" data-view-component="true" class="ActionListContent ActionListContent--visual16">
        <span class="ActionListItem-visual ActionListItem-visual--leading">
          <svg aria-hidden="true" data-component="Octicon" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-table">
    <path d="M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25ZM6.5 6.5v8h7.75a.25.25 0 0 0 .25-.25V6.5Zm8-1.5V1.75a.25.25 0 0 0-.25-.25H6.5V5Zm-13 1.5v7.75c0 .138.112.25.25.25H5v-8ZM5 5V1.5H1.75a.25.25 0 0 0-.25.25V5Z"></path>
</svg>
        </span>
      
        <span data-view-component="true" class="ActionListItem-label">
          Projects
</span>      
</a>
  
</li>
        <li hidden="hidden" data-menu-item="i4security-and-quality-tab" data-targets="action-list.items" role="none" data-view-component="true" class="ActionListItem">
    
    
    <a tabindex="-1" id="item-1b335629-922e-4f4d-8595-a32319a055e4" href="/feinan/leetcode-master/security" role="menuitem" data-view-component="true" class="ActionListContent ActionListContent--visual16">
        <span class="ActionListItem-visual ActionListItem-visual--leading">
          <svg aria-hidden="true" data-component="Octicon" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-shield">
    <path d="M7.467.133a1.748 1.748 0 0 1 1.066 0l5.25 1.68A1.75 1.75 0 0 1 15 3.48V7c0 1.566-.32 3.182-1.303 4.682-.983 1.498-2.585 2.813-5.032 3.855a1.697 1.697 0 0 1-1.33 0c-2.447-1.042-4.049-2.357-5.032-3.855C1.32 10.182 1 8.566 1 7V3.48a1.75 1.75 0 0 1 1.217-1.667Zm.61 1.429a.25.25 0 0 0-.153 0l-5.25 1.68a.25.25 0 0 0-.174.238V7c0 1.358.275 2.666 1.057 3.86.784 1.194 2.121 2.34 4.366 3.297a.196.196 0 0 0 .154 0c2.245-.956 3.582-2.104 4.366-3.298C13.225 9.666 13.5 8.36 13.5 7V3.48a.251.251 0 0 0-.174-.237l-5.25-1.68ZM8.75 4.75v3a.75.75 0 0 1-1.5 0v-3a.75.75 0 0 1 1.5 0ZM9 10.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path>
</svg>
        </span>
      
        <span data-view-component="true" class="ActionListItem-label">
          Security and quality
</span>      
</a>
  
</li>
        <li hidden="hidden" data-menu-item="i5insights-tab" data-targets="action-list.items" role="none" data-view-component="true" class="ActionListItem">
    
    
    <a tabindex="-1" id="item-e81ad171-b946-4cfa-ac55-3b30ae399d8b" href="/feinan/leetcode-master/pulse" role="menuitem" data-view-component="true" class="ActionListContent ActionListContent--visual16">
        <span class="ActionListItem-visual ActionListItem-visual--leading">
          <svg aria-hidden="true" data-component="Octicon" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-graph">
    <path d="M1.5 1.75V13.5h13.75a.75.75 0 0 1 0 1.5H.75a.75.75 0 0 1-.75-.75V1.75a.75.75 0 0 1 1.5 0Zm14.28 2.53-5.25 5.25a.75.75 0 0 1-1.06 0L7 7.06 4.28 9.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.25-3.25a.75.75 0 0 1 1.06 0L10 7.94l4.72-4.72a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042Z"></path>
</svg>
        </span>
      
        <span data-view-component="true" class="ActionListItem-label">
          Insights
</span>      
</a>
  
</li>
</ul>    
</div></action-list>


</div>
      
</div></anchored-position>  </focus-group>
</action-menu></div>
</nav>

    </div>
  



<turbo-frame id="repo-content-turbo-frame" target="_top" data-turbo-action="advance" class="">
    <div id="repo-content-pjax-container" class="repository-content " >
    



    
      
    








<react-app
  app-name="code-view"
  initial-path="/feinan/leetcode-master/blob/master/problems/1047.%E5%88%A0%E9%99%A4%E5%AD%97%E7%AC%A6%E4%B8%B2%E4%B8%AD%E7%9A%84%E6%89%80%E6%9C%89%E7%9B%B8%E9%82%BB%E9%87%8D%E5%A4%8D%E9%A1%B9.md"
  style="display: block; min-height: calc(100vh - 64px);"
  data-attempted-ssr="true"
  data-ssr="true"
  data-lazy="false"
  data-alternate="false"
  data-data-router-enabled="true"
  data-react-profiling="false"
>
  
  <script type="application/json" data-target="react-app.embeddedData">{"payload":{"codeViewBlobRoute":{"csv":null,"csvError":null,"headerInfo":{"toc":[{"level":1,"text":"1047. 删除字符串中的所有相邻重复项","anchor":"1047-删除字符串中的所有相邻重复项","htmlText":"1047. 删除字符串中的所有相邻重复项"},{"level":2,"text":"算法公开课","anchor":"算法公开课","htmlText":"算法公开课"},{"level":2,"text":"思路","anchor":"思路","htmlText":"思路"},{"level":3,"text":"正题","anchor":"正题","htmlText":"正题"},{"level":3,"text":"题外话","anchor":"题外话","htmlText":"题外话"},{"level":2,"text":"其他语言版本","anchor":"其他语言版本","htmlText":"其他语言版本"},{"level":3,"text":"Java：","anchor":"java","htmlText":"Java："},{"level":3,"text":"Python：","anchor":"python","htmlText":"Python："},{"level":3,"text":"Go：","anchor":"go","htmlText":"Go："},{"level":3,"text":"JavaScript:","anchor":"javascript","htmlText":"JavaScript:"},{"level":3,"text":"TypeScript：","anchor":"typescript","htmlText":"TypeScript："},{"level":3,"text":"C:","anchor":"c","htmlText":"C:"},{"level":3,"text":"Swift：","anchor":"swift","htmlText":"Swift："},{"level":3,"text":"C#:","anchor":"c-1","htmlText":"C#:"},{"level":3,"text":"PHP:","anchor":"php","htmlText":"PHP:"},{"level":3,"text":"Scala:","anchor":"scala","htmlText":"Scala:"},{"level":3,"text":"Rust:","anchor":"rust","htmlText":"Rust:"},{"level":3,"text":"Ruby","anchor":"ruby","htmlText":"Ruby"}]},"issueTemplate":null,"discussionTemplate":null,"richText":"\u003carticle class=\"markdown-body entry-content container-lg\" itemprop=\"text\"\u003e\u003cp align=\"center\" dir=\"auto\"\u003e\n\u003ca href=\"https://www.programmercarl.com/xunlian/xunlianying.html\" rel=\"nofollow\"\u003e\n  \u003cimg src=\"/feinan/leetcode-master/raw/master/pics/训练营.png\" width=\"1000\" style=\"max-width: 100%;\"\u003e\n\u003c/a\u003e\n\u003c/p\u003e\u003cp align=\"center\" dir=\"auto\"\u003e\u003cstrong\u003e\u003ca href=\"/feinan/leetcode-master/blob/master/problems/qita/join.md\"\u003e参与本项目\u003c/a\u003e，贡献其他语言版本的代码，拥抱开源，让更多学习算法的小伙伴们受益！\u003c/strong\u003e\u003c/p\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003e匹配问题都是栈的强项\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch1 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e1047. 删除字符串中的所有相邻重复项\u003c/h1\u003e\u003ca id=\"user-content-1047-删除字符串中的所有相邻重复项\" class=\"anchor\" aria-label=\"Permalink: 1047. 删除字符串中的所有相邻重复项\" href=\"#1047-删除字符串中的所有相邻重复项\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003ca href=\"https://leetcode.cn/problems/remove-all-adjacent-duplicates-in-string/\" rel=\"nofollow\"\u003e力扣题目链接\u003c/a\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e给出由小写字母组成的字符串 S，重复项删除操作会选择两个相邻且相同的字母，并删除它们。\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e在 S 上反复执行重复项删除操作，直到无法继续删除。\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e在完成所有重复项删除操作后返回最终的字符串。答案保证唯一。\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e示例：\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e输入：\"abbaca\"\u003c/li\u003e\n\u003cli\u003e输出：\"ca\"\u003c/li\u003e\n\u003cli\u003e解释：例如，在 \"abbaca\" 中，我们可以删除 \"bb\" 由于两字母相邻且相同，这是此时唯一可以执行删除操作的重复项。之后我们得到字符串 \"aaca\"，其中又只有 \"aa\" 可以执行重复项删除操作，所以最后的字符串为 \"ca\"。\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003e提示：\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e1 \u0026lt;= S.length \u0026lt;= 20000\u003c/li\u003e\n\u003cli\u003eS 仅由小写英文字母组成。\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e算法公开课\u003c/h2\u003e\u003ca id=\"user-content-算法公开课\" class=\"anchor\" aria-label=\"Permalink: 算法公开课\" href=\"#算法公开课\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003cstrong\u003e\u003ca href=\"https://programmercarl.com/other/gongkaike.html\" rel=\"nofollow\"\u003e《代码随想录》算法视频公开课\u003c/a\u003e：\u003ca href=\"https://www.bilibili.com/video/BV12a411P7mw\" rel=\"nofollow\"\u003e栈的好戏还要继续！| LeetCode：1047. 删除字符串中的所有相邻重复项\u003c/a\u003e，相信结合视频再看本篇题解，更有助于大家对本题的理解\u003c/strong\u003e。\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e思路\u003c/h2\u003e\u003ca id=\"user-content-思路\" class=\"anchor\" aria-label=\"Permalink: 思路\" href=\"#思路\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e正题\u003c/h3\u003e\u003ca id=\"user-content-正题\" class=\"anchor\" aria-label=\"Permalink: 正题\" href=\"#正题\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e本题要删除相邻相同元素，相对于\u003ca href=\"https://programmercarl.com/0020.%E6%9C%89%E6%95%88%E7%9A%84%E6%8B%AC%E5%8F%B7.html\" rel=\"nofollow\"\u003e20. 有效的括号\u003c/a\u003e来说其实也是匹配问题，20. 有效的括号 是匹配左右括号，本题是匹配相邻元素，最后都是做消除的操作。\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e本题也是用栈来解决的经典题目。\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e那么栈里应该放的是什么元素呢？\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e我们在删除相邻重复项的时候，其实就是要知道当前遍历的这个元素，我们在前一位是不是遍历过一样数值的元素，那么如何记录前面遍历过的元素呢？\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e所以就是用栈来存放，那么栈的目的，就是存放遍历过的元素，当遍历当前的这个元素的时候，去栈里看一下我们是不是遍历过相同数值的相邻元素。\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e然后再去做对应的消除操作。 如动画所示：\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https://camo.githubusercontent.com/e4b06f9bdca5c75449697d96f169f270edc1ec762383a64827505f6a437cf823/68747470733a2f2f636f64652d7468696e6b696e672e63646e2e626365626f732e636f6d2f676966732f313034372e2545352538382541302545392539392541342545352541442539372545372541432541362545342542382542322545342542382541442545372539412538342545362538392538302545362539432538392545372539422542382545392538322542422545392538372538442545352541342538442545392541312542392e676966\"\u003e\u003cimg src=\"https://camo.githubusercontent.com/e4b06f9bdca5c75449697d96f169f270edc1ec762383a64827505f6a437cf823/68747470733a2f2f636f64652d7468696e6b696e672e63646e2e626365626f732e636f6d2f676966732f313034372e2545352538382541302545392539392541342545352541442539372545372541432541362545342542382542322545342542382541442545372539412538342545362538392538302545362539432538392545372539422542382545392538322542422545392538372538442545352541342538442545392541312542392e676966\" alt=\"1047.删除字符串中的所有相邻重复项\" data-animated-image=\"\" data-canonical-src=\"https://code-thinking.cdn.bcebos.com/gifs/1047.%E5%88%A0%E9%99%A4%E5%AD%97%E7%AC%A6%E4%B8%B2%E4%B8%AD%E7%9A%84%E6%89%80%E6%9C%89%E7%9B%B8%E9%82%BB%E9%87%8D%E5%A4%8D%E9%A1%B9.gif\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e从栈中弹出剩余元素，此时是字符串ac，因为从栈里弹出的元素是倒序的，所以再对字符串进行反转一下，就得到了最终的结果。\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eC++代码 :\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"class Solution {\npublic:\n    string removeDuplicates(string S) {\n        stack\u0026lt;char\u0026gt; st;\n        for (char s : S) {\n            if (st.empty() || s != st.top()) {\n                st.push(s);\n            } else {\n                st.pop(); // s 与 st.top()相等的情况\n            }\n        }\n        string result = \u0026quot;\u0026quot;;\n        while (!st.empty()) { // 将栈中元素放到result字符串汇总\n            result += st.top();\n            st.pop();\n        }\n        reverse (result.begin(), result.end()); // 此时字符串需要反转一下\n        return result;\n\n    }\n};\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003eclass\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eSolution\u003c/span\u003e {\n\u003cspan class=\"pl-k\"\u003epublic:\u003c/span\u003e\n    string \u003cspan class=\"pl-en\"\u003eremoveDuplicates\u003c/span\u003e(string S) {\n        stack\u0026lt;\u003cspan class=\"pl-k\"\u003echar\u003c/span\u003e\u0026gt; st;\n        \u003cspan class=\"pl-k\"\u003efor\u003c/span\u003e (\u003cspan class=\"pl-k\"\u003echar\u003c/span\u003e s : S) {\n            \u003cspan class=\"pl-k\"\u003eif\u003c/span\u003e (st.\u003cspan class=\"pl-c1\"\u003eempty\u003c/span\u003e() || s != st.\u003cspan class=\"pl-c1\"\u003etop\u003c/span\u003e()) {\n                st.\u003cspan class=\"pl-c1\"\u003epush\u003c/span\u003e(s);\n            } \u003cspan class=\"pl-k\"\u003eelse\u003c/span\u003e {\n                st.\u003cspan class=\"pl-c1\"\u003epop\u003c/span\u003e(); \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e s 与 st.top()相等的情况\u003c/span\u003e\n            }\n        }\n        string result = \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e;\n        \u003cspan class=\"pl-k\"\u003ewhile\u003c/span\u003e (!st.\u003cspan class=\"pl-c1\"\u003eempty\u003c/span\u003e()) { \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e 将栈中元素放到result字符串汇总\u003c/span\u003e\n            result += st.\u003cspan class=\"pl-c1\"\u003etop\u003c/span\u003e();\n            st.\u003cspan class=\"pl-c1\"\u003epop\u003c/span\u003e();\n        }\n        \u003cspan class=\"pl-c1\"\u003ereverse\u003c/span\u003e (result.\u003cspan class=\"pl-c1\"\u003ebegin\u003c/span\u003e(), result.\u003cspan class=\"pl-c1\"\u003eend\u003c/span\u003e()); \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e 此时字符串需要反转一下\u003c/span\u003e\n        \u003cspan class=\"pl-k\"\u003ereturn\u003c/span\u003e result;\n\n    }\n};\u003c/pre\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e时间复杂度: O(n)\u003c/li\u003e\n\u003cli\u003e空间复杂度: O(n)\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003e当然可以拿字符串直接作为栈，这样省去了栈还要转为字符串的操作。\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e代码如下：\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"class Solution {\npublic:\n    string removeDuplicates(string S) {\n        string result;\n        for(char s : S) {\n            if(result.empty() || result.back() != s) {\n                result.push_back(s);\n            }\n            else {\n                result.pop_back();\n            }\n        }\n        return result;\n    }\n};\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003eclass\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eSolution\u003c/span\u003e {\n\u003cspan class=\"pl-k\"\u003epublic:\u003c/span\u003e\n    string \u003cspan class=\"pl-en\"\u003eremoveDuplicates\u003c/span\u003e(string S) {\n        string result;\n        \u003cspan class=\"pl-k\"\u003efor\u003c/span\u003e(\u003cspan class=\"pl-k\"\u003echar\u003c/span\u003e s : S) {\n            \u003cspan class=\"pl-k\"\u003eif\u003c/span\u003e(result.\u003cspan class=\"pl-c1\"\u003eempty\u003c/span\u003e() || result.\u003cspan class=\"pl-c1\"\u003eback\u003c/span\u003e() != s) {\n                result.\u003cspan class=\"pl-c1\"\u003epush_back\u003c/span\u003e(s);\n            }\n            \u003cspan class=\"pl-k\"\u003eelse\u003c/span\u003e {\n                result.\u003cspan class=\"pl-c1\"\u003epop_back\u003c/span\u003e();\n            }\n        }\n        \u003cspan class=\"pl-k\"\u003ereturn\u003c/span\u003e result;\n    }\n};\u003c/pre\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e时间复杂度: O(n)\u003c/li\u003e\n\u003cli\u003e空间复杂度: O(1)，返回值不计空间复杂度\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e题外话\u003c/h3\u003e\u003ca id=\"user-content-题外话\" class=\"anchor\" aria-label=\"Permalink: 题外话\" href=\"#题外话\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e这道题目就像是我们玩过的游戏对对碰，如果相同的元素挨在一起就要消除。\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e可能我们在玩游戏的时候感觉理所当然应该消除，但程序又怎么知道该如何消除呢，特别是消除之后又有新的元素可能挨在一起。\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e此时游戏的后端逻辑就可以用一个栈来实现（我没有实际考察对对碰或者爱消除游戏的代码实现，仅从原理上进行推断）。\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e游戏开发可能使用栈结构，编程语言的一些功能实现也会使用栈结构，实现函数递归调用就需要栈，但不是每种编程语言都支持递归，例如：\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003cstrong\u003e递归的实现就是：每一次递归调用都会把函数的局部变量、参数值和返回地址等压入调用栈中\u003c/strong\u003e，然后递归返回的时候，从栈顶弹出上一次递归的各项参数，所以这就是递归为什么可以返回上一层位置的原因。\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e相信大家应该遇到过一种错误就是栈溢出，系统输出的异常是\u003ccode\u003eSegmentation fault\u003c/code\u003e（当然不是所有的\u003ccode\u003eSegmentation fault\u003c/code\u003e 都是栈溢出导致的） ，如果你使用了递归，就要想一想是不是无限递归了，那么系统调用栈就会溢出。\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e而且\u003cstrong\u003e在企业项目开发中，尽量不要使用递归\u003c/strong\u003e！在项目比较大的时候，由于参数多，全局变量等等，使用递归很容易判断不充分return的条件，非常容易无限递归（或者递归层级过深），\u003cstrong\u003e造成栈溢出错误（这种问题还不好排查！）\u003c/strong\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e其他语言版本\u003c/h2\u003e\u003ca id=\"user-content-其他语言版本\" class=\"anchor\" aria-label=\"Permalink: 其他语言版本\" href=\"#其他语言版本\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eJava：\u003c/h3\u003e\u003ca id=\"user-content-java\" class=\"anchor\" aria-label=\"Permalink: Java：\" href=\"#java\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e使用 Deque 作为堆栈\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-java notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"class Solution {\n    public String removeDuplicates(String S) {\n        //ArrayDeque会比LinkedList在除了删除元素这一点外会快一点\n        //参考：https://stackoverflow.com/questions/6163166/why-is-arraydeque-better-than-linkedlist\n        ArrayDeque\u0026lt;Character\u0026gt; deque = new ArrayDeque\u0026lt;\u0026gt;();\n        char ch;\n        for (int i = 0; i \u0026lt; S.length(); i++) {\n            ch = S.charAt(i);\n            if (deque.isEmpty() || deque.peek() != ch) {\n                deque.push(ch);\n            } else {\n                deque.pop();\n            }\n        }\n        String str = \u0026quot;\u0026quot;;\n        //剩余的元素即为不重复的元素\n        while (!deque.isEmpty()) {\n            str = deque.pop() + str;\n        }\n        return str;\n    }\n}\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003eclass\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003eSolution\u003c/span\u003e {\n    \u003cspan class=\"pl-k\"\u003epublic\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003eString\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eremoveDuplicates\u003c/span\u003e(\u003cspan class=\"pl-smi\"\u003eString\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eS\u003c/span\u003e) {\n        \u003cspan class=\"pl-c\"\u003e//ArrayDeque会比LinkedList在除了删除元素这一点外会快一点\u003c/span\u003e\n        \u003cspan class=\"pl-c\"\u003e//参考：https://stackoverflow.com/questions/6163166/why-is-arraydeque-better-than-linkedlist\u003c/span\u003e\n        \u003cspan class=\"pl-smi\"\u003eArrayDeque\u003c/span\u003e\u0026lt;\u003cspan class=\"pl-smi\"\u003eCharacter\u003c/span\u003e\u0026gt; \u003cspan class=\"pl-s1\"\u003edeque\u003c/span\u003e = \u003cspan class=\"pl-k\"\u003enew\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003eArrayDeque\u003c/span\u003e\u0026lt;\u0026gt;();\n        \u003cspan class=\"pl-smi\"\u003echar\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003ech\u003c/span\u003e;\n        \u003cspan class=\"pl-k\"\u003efor\u003c/span\u003e (\u003cspan class=\"pl-smi\"\u003eint\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003ei\u003c/span\u003e = \u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e; \u003cspan class=\"pl-s1\"\u003ei\u003c/span\u003e \u0026lt; \u003cspan class=\"pl-smi\"\u003eS\u003c/span\u003e.\u003cspan class=\"pl-en\"\u003elength\u003c/span\u003e(); \u003cspan class=\"pl-s1\"\u003ei\u003c/span\u003e++) {\n            \u003cspan class=\"pl-s1\"\u003ech\u003c/span\u003e = \u003cspan class=\"pl-smi\"\u003eS\u003c/span\u003e.\u003cspan class=\"pl-en\"\u003echarAt\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003ei\u003c/span\u003e);\n            \u003cspan class=\"pl-k\"\u003eif\u003c/span\u003e (\u003cspan class=\"pl-s1\"\u003edeque\u003c/span\u003e.\u003cspan class=\"pl-en\"\u003eisEmpty\u003c/span\u003e() || \u003cspan class=\"pl-s1\"\u003edeque\u003c/span\u003e.\u003cspan class=\"pl-en\"\u003epeek\u003c/span\u003e() != \u003cspan class=\"pl-s1\"\u003ech\u003c/span\u003e) {\n                \u003cspan class=\"pl-s1\"\u003edeque\u003c/span\u003e.\u003cspan class=\"pl-en\"\u003epush\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003ech\u003c/span\u003e);\n            } \u003cspan class=\"pl-k\"\u003eelse\u003c/span\u003e {\n                \u003cspan class=\"pl-s1\"\u003edeque\u003c/span\u003e.\u003cspan class=\"pl-en\"\u003epop\u003c/span\u003e();\n            }\n        }\n        \u003cspan class=\"pl-smi\"\u003eString\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003estr\u003c/span\u003e = \u003cspan class=\"pl-s\"\u003e\"\"\u003c/span\u003e;\n        \u003cspan class=\"pl-c\"\u003e//剩余的元素即为不重复的元素\u003c/span\u003e\n        \u003cspan class=\"pl-k\"\u003ewhile\u003c/span\u003e (!\u003cspan class=\"pl-s1\"\u003edeque\u003c/span\u003e.\u003cspan class=\"pl-en\"\u003eisEmpty\u003c/span\u003e()) {\n            \u003cspan class=\"pl-s1\"\u003estr\u003c/span\u003e = \u003cspan class=\"pl-s1\"\u003edeque\u003c/span\u003e.\u003cspan class=\"pl-en\"\u003epop\u003c/span\u003e() + \u003cspan class=\"pl-s1\"\u003estr\u003c/span\u003e;\n        }\n        \u003cspan class=\"pl-k\"\u003ereturn\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003estr\u003c/span\u003e;\n    }\n}\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e拿字符串直接作为栈，省去了栈还要转为字符串的操作。\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-java notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"class Solution {\n    public String removeDuplicates(String s) {\n        // 将 res 当做栈\n        // 也可以用 StringBuilder 来修改字符串，速度更快\n        // StringBuilder res = new StringBuilder();\n        StringBuffer res = new StringBuffer();\n        // top为 res 的长度\n        int top = -1;\n        for (int i = 0; i \u0026lt; s.length(); i++) {\n            char c = s.charAt(i);\n            // 当 top \u0026gt; 0,即栈中有字符时，当前字符如果和栈中字符相等，弹出栈顶字符，同时 top--\n            if (top \u0026gt;= 0 \u0026amp;\u0026amp; res.charAt(top) == c) {\n                res.deleteCharAt(top);\n                top--;\n            // 否则，将该字符 入栈，同时top++\n            } else {\n                res.append(c);\n                top++;\n            }\n        }\n        return res.toString();\n    }\n}\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003eclass\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003eSolution\u003c/span\u003e {\n    \u003cspan class=\"pl-k\"\u003epublic\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003eString\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eremoveDuplicates\u003c/span\u003e(\u003cspan class=\"pl-smi\"\u003eString\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003es\u003c/span\u003e) {\n        \u003cspan class=\"pl-c\"\u003e// 将 res 当做栈\u003c/span\u003e\n        \u003cspan class=\"pl-c\"\u003e// 也可以用 StringBuilder 来修改字符串，速度更快\u003c/span\u003e\n        \u003cspan class=\"pl-c\"\u003e// StringBuilder res = new StringBuilder();\u003c/span\u003e\n        \u003cspan class=\"pl-smi\"\u003eStringBuffer\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eres\u003c/span\u003e = \u003cspan class=\"pl-k\"\u003enew\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003eStringBuffer\u003c/span\u003e();\n        \u003cspan class=\"pl-c\"\u003e// top为 res 的长度\u003c/span\u003e\n        \u003cspan class=\"pl-smi\"\u003eint\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003etop\u003c/span\u003e = -\u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e;\n        \u003cspan class=\"pl-k\"\u003efor\u003c/span\u003e (\u003cspan class=\"pl-smi\"\u003eint\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003ei\u003c/span\u003e = \u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e; \u003cspan class=\"pl-s1\"\u003ei\u003c/span\u003e \u0026lt; \u003cspan class=\"pl-s1\"\u003es\u003c/span\u003e.\u003cspan class=\"pl-en\"\u003elength\u003c/span\u003e(); \u003cspan class=\"pl-s1\"\u003ei\u003c/span\u003e++) {\n            \u003cspan class=\"pl-smi\"\u003echar\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003ec\u003c/span\u003e = \u003cspan class=\"pl-s1\"\u003es\u003c/span\u003e.\u003cspan class=\"pl-en\"\u003echarAt\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003ei\u003c/span\u003e);\n            \u003cspan class=\"pl-c\"\u003e// 当 top \u0026gt; 0,即栈中有字符时，当前字符如果和栈中字符相等，弹出栈顶字符，同时 top--\u003c/span\u003e\n            \u003cspan class=\"pl-k\"\u003eif\u003c/span\u003e (\u003cspan class=\"pl-s1\"\u003etop\u003c/span\u003e \u0026gt;= \u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e \u0026amp;\u0026amp; \u003cspan class=\"pl-s1\"\u003eres\u003c/span\u003e.\u003cspan class=\"pl-en\"\u003echarAt\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003etop\u003c/span\u003e) == \u003cspan class=\"pl-s1\"\u003ec\u003c/span\u003e) {\n                \u003cspan class=\"pl-s1\"\u003eres\u003c/span\u003e.\u003cspan class=\"pl-en\"\u003edeleteCharAt\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003etop\u003c/span\u003e);\n                \u003cspan class=\"pl-s1\"\u003etop\u003c/span\u003e--;\n            \u003cspan class=\"pl-c\"\u003e// 否则，将该字符 入栈，同时top++\u003c/span\u003e\n            } \u003cspan class=\"pl-k\"\u003eelse\u003c/span\u003e {\n                \u003cspan class=\"pl-s1\"\u003eres\u003c/span\u003e.\u003cspan class=\"pl-en\"\u003eappend\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003ec\u003c/span\u003e);\n                \u003cspan class=\"pl-s1\"\u003etop\u003c/span\u003e++;\n            }\n        }\n        \u003cspan class=\"pl-k\"\u003ereturn\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eres\u003c/span\u003e.\u003cspan class=\"pl-en\"\u003etoString\u003c/span\u003e();\n    }\n}\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e拓展：双指针\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-java notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"class Solution {\n    public String removeDuplicates(String s) {\n        char[] ch = s.toCharArray();\n        int fast = 0;\n        int slow = 0;\n        while(fast \u0026lt; s.length()){\n            // 直接用fast指针覆盖slow指针的值\n            ch[slow] = ch[fast];\n            // 遇到前后相同值的，就跳过，即slow指针后退一步，下次循环就可以直接被覆盖掉了\n            if(slow \u0026gt; 0 \u0026amp;\u0026amp; ch[slow] == ch[slow - 1]){\n                slow--;\n            }else{\n                slow++;\n            }\n            fast++;\n        }\n        return new String(ch,0,slow);\n    }\n}\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003eclass\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003eSolution\u003c/span\u003e {\n    \u003cspan class=\"pl-k\"\u003epublic\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003eString\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eremoveDuplicates\u003c/span\u003e(\u003cspan class=\"pl-smi\"\u003eString\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003es\u003c/span\u003e) {\n        \u003cspan class=\"pl-smi\"\u003echar\u003c/span\u003e[] \u003cspan class=\"pl-s1\"\u003ech\u003c/span\u003e = \u003cspan class=\"pl-s1\"\u003es\u003c/span\u003e.\u003cspan class=\"pl-en\"\u003etoCharArray\u003c/span\u003e();\n        \u003cspan class=\"pl-smi\"\u003eint\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003efast\u003c/span\u003e = \u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e;\n        \u003cspan class=\"pl-smi\"\u003eint\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eslow\u003c/span\u003e = \u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e;\n        \u003cspan class=\"pl-k\"\u003ewhile\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003efast\u003c/span\u003e \u0026lt; \u003cspan class=\"pl-s1\"\u003es\u003c/span\u003e.\u003cspan class=\"pl-en\"\u003elength\u003c/span\u003e()){\n            \u003cspan class=\"pl-c\"\u003e// 直接用fast指针覆盖slow指针的值\u003c/span\u003e\n            \u003cspan class=\"pl-s1\"\u003ech\u003c/span\u003e[\u003cspan class=\"pl-s1\"\u003eslow\u003c/span\u003e] = \u003cspan class=\"pl-s1\"\u003ech\u003c/span\u003e[\u003cspan class=\"pl-s1\"\u003efast\u003c/span\u003e];\n            \u003cspan class=\"pl-c\"\u003e// 遇到前后相同值的，就跳过，即slow指针后退一步，下次循环就可以直接被覆盖掉了\u003c/span\u003e\n            \u003cspan class=\"pl-k\"\u003eif\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003eslow\u003c/span\u003e \u0026gt; \u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e \u0026amp;\u0026amp; \u003cspan class=\"pl-s1\"\u003ech\u003c/span\u003e[\u003cspan class=\"pl-s1\"\u003eslow\u003c/span\u003e] == \u003cspan class=\"pl-s1\"\u003ech\u003c/span\u003e[\u003cspan class=\"pl-s1\"\u003eslow\u003c/span\u003e - \u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e]){\n                \u003cspan class=\"pl-s1\"\u003eslow\u003c/span\u003e--;\n            }\u003cspan class=\"pl-k\"\u003eelse\u003c/span\u003e{\n                \u003cspan class=\"pl-s1\"\u003eslow\u003c/span\u003e++;\n            }\n            \u003cspan class=\"pl-s1\"\u003efast\u003c/span\u003e++;\n        }\n        \u003cspan class=\"pl-k\"\u003ereturn\u003c/span\u003e \u003cspan class=\"pl-k\"\u003enew\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003eString\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003ech\u003c/span\u003e,\u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e,\u003cspan class=\"pl-s1\"\u003eslow\u003c/span\u003e);\n    }\n}\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003ePython：\u003c/h3\u003e\u003ca id=\"user-content-python\" class=\"anchor\" aria-label=\"Permalink: Python：\" href=\"#python\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"highlight highlight-source-python notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"# 方法一，使用栈\nclass Solution:\n    def removeDuplicates(self, s: str) -\u0026gt; str:\n        res = list()\n        for item in s:\n            if res and res[-1] == item:\n                res.pop()\n            else:\n                res.append(item)\n        return \u0026quot;\u0026quot;.join(res)  # 字符串拼接\"\u003e\u003cpre\u003e\u003cspan class=\"pl-c\"\u003e# 方法一，使用栈\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003eclass\u003c/span\u003e \u003cspan class=\"pl-v\"\u003eSolution\u003c/span\u003e:\n    \u003cspan class=\"pl-k\"\u003edef\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eremoveDuplicates\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003eself\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003es\u003c/span\u003e: \u003cspan class=\"pl-smi\"\u003estr\u003c/span\u003e) \u003cspan class=\"pl-c1\"\u003e-\u0026gt;\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003estr\u003c/span\u003e:\n        \u003cspan class=\"pl-s1\"\u003eres\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-en\"\u003elist\u003c/span\u003e()\n        \u003cspan class=\"pl-k\"\u003efor\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eitem\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003ein\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003es\u003c/span\u003e:\n            \u003cspan class=\"pl-k\"\u003eif\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eres\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003eand\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eres\u003c/span\u003e[\u003cspan class=\"pl-c1\"\u003e-\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e] \u003cspan class=\"pl-c1\"\u003e==\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eitem\u003c/span\u003e:\n                \u003cspan class=\"pl-s1\"\u003eres\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003epop\u003c/span\u003e()\n            \u003cspan class=\"pl-k\"\u003eelse\u003c/span\u003e:\n                \u003cspan class=\"pl-s1\"\u003eres\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003eappend\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003eitem\u003c/span\u003e)\n        \u003cspan class=\"pl-k\"\u003ereturn\u003c/span\u003e \u003cspan class=\"pl-s\"\u003e\"\"\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003ejoin\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003eres\u003c/span\u003e)  \u003cspan class=\"pl-c\"\u003e# 字符串拼接\u003c/span\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"highlight highlight-source-python notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"# 方法二，使用双指针模拟栈，如果不让用栈可以作为备选方法。\nclass Solution:\n    def removeDuplicates(self, s: str) -\u0026gt; str:\n        res = list(s)\n        slow = fast = 0\n        length = len(res)\n\n        while fast \u0026lt; length:\n            # 如果一样直接换，不一样会把后面的填在slow的位置\n            res[slow] = res[fast]\n            \n            # 如果发现和前一个一样，就退一格指针\n            if slow \u0026gt; 0 and res[slow] == res[slow - 1]:\n                slow -= 1\n            else:\n                slow += 1\n            fast += 1\n            \n        return ''.join(res[0: slow])\"\u003e\u003cpre\u003e\u003cspan class=\"pl-c\"\u003e# 方法二，使用双指针模拟栈，如果不让用栈可以作为备选方法。\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003eclass\u003c/span\u003e \u003cspan class=\"pl-v\"\u003eSolution\u003c/span\u003e:\n    \u003cspan class=\"pl-k\"\u003edef\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eremoveDuplicates\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003eself\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003es\u003c/span\u003e: \u003cspan class=\"pl-smi\"\u003estr\u003c/span\u003e) \u003cspan class=\"pl-c1\"\u003e-\u0026gt;\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003estr\u003c/span\u003e:\n        \u003cspan class=\"pl-s1\"\u003eres\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-en\"\u003elist\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003es\u003c/span\u003e)\n        \u003cspan class=\"pl-s1\"\u003eslow\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003efast\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e\n        \u003cspan class=\"pl-s1\"\u003elength\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-en\"\u003elen\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003eres\u003c/span\u003e)\n\n        \u003cspan class=\"pl-k\"\u003ewhile\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003efast\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e\u0026lt;\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003elength\u003c/span\u003e:\n            \u003cspan class=\"pl-c\"\u003e# 如果一样直接换，不一样会把后面的填在slow的位置\u003c/span\u003e\n            \u003cspan class=\"pl-s1\"\u003eres\u003c/span\u003e[\u003cspan class=\"pl-s1\"\u003eslow\u003c/span\u003e] \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eres\u003c/span\u003e[\u003cspan class=\"pl-s1\"\u003efast\u003c/span\u003e]\n            \n            \u003cspan class=\"pl-c\"\u003e# 如果发现和前一个一样，就退一格指针\u003c/span\u003e\n            \u003cspan class=\"pl-k\"\u003eif\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eslow\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e\u0026gt;\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003eand\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eres\u003c/span\u003e[\u003cspan class=\"pl-s1\"\u003eslow\u003c/span\u003e] \u003cspan class=\"pl-c1\"\u003e==\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eres\u003c/span\u003e[\u003cspan class=\"pl-s1\"\u003eslow\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e-\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e]:\n                \u003cspan class=\"pl-s1\"\u003eslow\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e-=\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e\n            \u003cspan class=\"pl-k\"\u003eelse\u003c/span\u003e:\n                \u003cspan class=\"pl-s1\"\u003eslow\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e+=\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e\n            \u003cspan class=\"pl-s1\"\u003efast\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e+=\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e\n            \n        \u003cspan class=\"pl-k\"\u003ereturn\u003c/span\u003e \u003cspan class=\"pl-s\"\u003e''\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003ejoin\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003eres\u003c/span\u003e[\u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e: \u003cspan class=\"pl-s1\"\u003eslow\u003c/span\u003e])\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eGo：\u003c/h3\u003e\u003ca id=\"user-content-go\" class=\"anchor\" aria-label=\"Permalink: Go：\" href=\"#go\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"highlight highlight-source-go notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"func removeDuplicates(s string) string {\n    var stack []byte\n    for i := 0; i \u0026lt; len(s);i++ {\n        // 栈不空 且 与栈顶元素不等\n        if len(stack) \u0026gt; 0 \u0026amp;\u0026amp; stack[len(stack)-1] == s[i] {\n            // 弹出栈顶元素 并 忽略当前元素(s[i])\n            stack = stack[:len(stack)-1]\n        }else{\n            // 入栈\n            stack = append(stack, s[i])\n        }\n    }\n    return string(stack)\n}\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003efunc\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eremoveDuplicates\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003es\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003estring\u003c/span\u003e) \u003cspan class=\"pl-smi\"\u003estring\u003c/span\u003e {\n    \u003cspan class=\"pl-k\"\u003evar\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003estack\u003c/span\u003e []\u003cspan class=\"pl-smi\"\u003ebyte\u003c/span\u003e\n    \u003cspan class=\"pl-k\"\u003efor\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003ei\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e:=\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e; \u003cspan class=\"pl-s1\"\u003ei\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e\u0026lt;\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003elen\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003es\u003c/span\u003e);\u003cspan class=\"pl-s1\"\u003ei\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e++\u003c/span\u003e {\n        \u003cspan class=\"pl-c\"\u003e// 栈不空 且 与栈顶元素不等\u003c/span\u003e\n        \u003cspan class=\"pl-k\"\u003eif\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003elen\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003estack\u003c/span\u003e) \u003cspan class=\"pl-c1\"\u003e\u0026gt;\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e\u0026amp;\u0026amp;\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003estack\u003c/span\u003e[\u003cspan class=\"pl-s1\"\u003elen\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003estack\u003c/span\u003e)\u003cspan class=\"pl-c1\"\u003e-\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e] \u003cspan class=\"pl-c1\"\u003e==\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003es\u003c/span\u003e[\u003cspan class=\"pl-s1\"\u003ei\u003c/span\u003e] {\n            \u003cspan class=\"pl-c\"\u003e// 弹出栈顶元素 并 忽略当前元素(s[i])\u003c/span\u003e\n            \u003cspan class=\"pl-s1\"\u003estack\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003estack\u003c/span\u003e[:\u003cspan class=\"pl-s1\"\u003elen\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003estack\u003c/span\u003e)\u003cspan class=\"pl-c1\"\u003e-\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e]\n        }\u003cspan class=\"pl-k\"\u003eelse\u003c/span\u003e{\n            \u003cspan class=\"pl-c\"\u003e// 入栈\u003c/span\u003e\n            \u003cspan class=\"pl-s1\"\u003estack\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eappend\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003estack\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003es\u003c/span\u003e[\u003cspan class=\"pl-s1\"\u003ei\u003c/span\u003e])\n        }\n    }\n    \u003cspan class=\"pl-k\"\u003ereturn\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003estring\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003estack\u003c/span\u003e)\n}\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eJavaScript:\u003c/h3\u003e\u003ca id=\"user-content-javascript\" class=\"anchor\" aria-label=\"Permalink: JavaScript:\" href=\"#javascript\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e法一：使用栈\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-js notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"var removeDuplicates = function(s) {\n    const result = []\n    for(const i of s){\n        if(i === result[result.length-1]){\n            result.pop()\n        }else{\n            result.push(i)\n        }\n    }\n    return result.join('')\n};\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003evar\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eremoveDuplicates\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-k\"\u003efunction\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e(\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003es\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e)\u003c/span\u003e \u003cspan class=\"pl-kos\"\u003e{\u003c/span\u003e\n    \u003cspan class=\"pl-k\"\u003econst\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eresult\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-kos\"\u003e[\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e]\u003c/span\u003e\n    \u003cspan class=\"pl-k\"\u003efor\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e(\u003c/span\u003e\u003cspan class=\"pl-k\"\u003econst\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003ei\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eof\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003es\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e)\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e{\u003c/span\u003e\n        \u003cspan class=\"pl-k\"\u003eif\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e(\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003ei\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e===\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eresult\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e[\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003eresult\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e.\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003elength\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e-\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e]\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e)\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e{\u003c/span\u003e\n            \u003cspan class=\"pl-s1\"\u003eresult\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e.\u003c/span\u003e\u003cspan class=\"pl-en\"\u003epop\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e(\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e)\u003c/span\u003e\n        \u003cspan class=\"pl-kos\"\u003e}\u003c/span\u003e\u003cspan class=\"pl-k\"\u003eelse\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e{\u003c/span\u003e\n            \u003cspan class=\"pl-s1\"\u003eresult\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e.\u003c/span\u003e\u003cspan class=\"pl-en\"\u003epush\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e(\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003ei\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e)\u003c/span\u003e\n        \u003cspan class=\"pl-kos\"\u003e}\u003c/span\u003e\n    \u003cspan class=\"pl-kos\"\u003e}\u003c/span\u003e\n    \u003cspan class=\"pl-k\"\u003ereturn\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eresult\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e.\u003c/span\u003e\u003cspan class=\"pl-en\"\u003ejoin\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e(\u003c/span\u003e\u003cspan class=\"pl-s\"\u003e''\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e)\u003c/span\u003e\n\u003cspan class=\"pl-kos\"\u003e}\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e;\u003c/span\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e法二：双指针（模拟栈）\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-js notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"// 原地解法（双指针模拟栈）\nvar removeDuplicates = function(s) {\n    s = [...s];\n    let top = -1; // 指向栈顶元素的下标\n    for(let i = 0; i \u0026lt; s.length; i++) {\n        if(top === -1 || s[top] !== s[i]) { // top === -1 即空栈\n            s[++top] = s[i]; // 入栈\n        } else {\n            top--; // 推出栈\n        }\n    }\n    s.length = top + 1; // 栈顶元素下标 + 1 为栈的长度\n    return s.join('');\n};\"\u003e\u003cpre\u003e\u003cspan class=\"pl-c\"\u003e// 原地解法（双指针模拟栈）\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003evar\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eremoveDuplicates\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-k\"\u003efunction\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e(\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003es\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e)\u003c/span\u003e \u003cspan class=\"pl-kos\"\u003e{\u003c/span\u003e\n    \u003cspan class=\"pl-s1\"\u003es\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-kos\"\u003e[\u003c/span\u003e...\u003cspan class=\"pl-s1\"\u003es\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e]\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e;\u003c/span\u003e\n    \u003cspan class=\"pl-k\"\u003elet\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003etop\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e-\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e;\u003c/span\u003e \u003cspan class=\"pl-c\"\u003e// 指向栈顶元素的下标\u003c/span\u003e\n    \u003cspan class=\"pl-k\"\u003efor\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e(\u003c/span\u003e\u003cspan class=\"pl-k\"\u003elet\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003ei\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e;\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003ei\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e\u0026lt;\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003es\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e.\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003elength\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e;\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003ei\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e++\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e)\u003c/span\u003e \u003cspan class=\"pl-kos\"\u003e{\u003c/span\u003e\n        \u003cspan class=\"pl-k\"\u003eif\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e(\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003etop\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e===\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e-\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e||\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003es\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e[\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003etop\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e]\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e!==\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003es\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e[\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003ei\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e]\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e)\u003c/span\u003e \u003cspan class=\"pl-kos\"\u003e{\u003c/span\u003e \u003cspan class=\"pl-c\"\u003e// top === -1 即空栈\u003c/span\u003e\n            \u003cspan class=\"pl-s1\"\u003es\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e[\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e++\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003etop\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e]\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003es\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e[\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003ei\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e]\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e;\u003c/span\u003e \u003cspan class=\"pl-c\"\u003e// 入栈\u003c/span\u003e\n        \u003cspan class=\"pl-kos\"\u003e}\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eelse\u003c/span\u003e \u003cspan class=\"pl-kos\"\u003e{\u003c/span\u003e\n            \u003cspan class=\"pl-s1\"\u003etop\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e--\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e;\u003c/span\u003e \u003cspan class=\"pl-c\"\u003e// 推出栈\u003c/span\u003e\n        \u003cspan class=\"pl-kos\"\u003e}\u003c/span\u003e\n    \u003cspan class=\"pl-kos\"\u003e}\u003c/span\u003e\n    \u003cspan class=\"pl-s1\"\u003es\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e.\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003elength\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003etop\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e+\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e;\u003c/span\u003e \u003cspan class=\"pl-c\"\u003e// 栈顶元素下标 + 1 为栈的长度\u003c/span\u003e\n    \u003cspan class=\"pl-k\"\u003ereturn\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003es\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e.\u003c/span\u003e\u003cspan class=\"pl-en\"\u003ejoin\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e(\u003c/span\u003e\u003cspan class=\"pl-s\"\u003e''\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e)\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e;\u003c/span\u003e\n\u003cspan class=\"pl-kos\"\u003e}\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e;\u003c/span\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eTypeScript：\u003c/h3\u003e\u003ca id=\"user-content-typescript\" class=\"anchor\" aria-label=\"Permalink: TypeScript：\" href=\"#typescript\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"highlight highlight-source-ts notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"function removeDuplicates(s: string): string {\n    const helperStack: string[] = [];\n    let i: number = 0;\n    while (i \u0026lt; s.length) {\n        let top: string = helperStack[helperStack.length - 1];\n        if (top === s[i]) {\n            helperStack.pop();\n        } else {\n            helperStack.push(s[i]);\n        }\n        i++;\n    }\n    let res: string = '';\n    while (helperStack.length \u0026gt; 0) {\n        res = helperStack.pop() + res;\n    }\n    return res;\n};\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003efunction\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eremoveDuplicates\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e(\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003es\u003c/span\u003e: \u003cspan class=\"pl-smi\"\u003estring\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e)\u003c/span\u003e: \u003cspan class=\"pl-smi\"\u003estring\u003c/span\u003e \u003cspan class=\"pl-kos\"\u003e{\u003c/span\u003e\n    \u003cspan class=\"pl-k\"\u003econst\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003ehelperStack\u003c/span\u003e: \u003cspan class=\"pl-smi\"\u003estring\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e[\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e]\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-kos\"\u003e[\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e]\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e;\u003c/span\u003e\n    \u003cspan class=\"pl-k\"\u003elet\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003ei\u003c/span\u003e: \u003cspan class=\"pl-smi\"\u003enumber\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e;\u003c/span\u003e\n    \u003cspan class=\"pl-k\"\u003ewhile\u003c/span\u003e \u003cspan class=\"pl-kos\"\u003e(\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003ei\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e\u0026lt;\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003es\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e.\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003elength\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e)\u003c/span\u003e \u003cspan class=\"pl-kos\"\u003e{\u003c/span\u003e\n        \u003cspan class=\"pl-k\"\u003elet\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003etop\u003c/span\u003e: \u003cspan class=\"pl-smi\"\u003estring\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003ehelperStack\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e[\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003ehelperStack\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e.\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003elength\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e-\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e]\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e;\u003c/span\u003e\n        \u003cspan class=\"pl-k\"\u003eif\u003c/span\u003e \u003cspan class=\"pl-kos\"\u003e(\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003etop\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e===\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003es\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e[\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003ei\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e]\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e)\u003c/span\u003e \u003cspan class=\"pl-kos\"\u003e{\u003c/span\u003e\n            \u003cspan class=\"pl-s1\"\u003ehelperStack\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e.\u003c/span\u003e\u003cspan class=\"pl-en\"\u003epop\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e(\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e)\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e;\u003c/span\u003e\n        \u003cspan class=\"pl-kos\"\u003e}\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eelse\u003c/span\u003e \u003cspan class=\"pl-kos\"\u003e{\u003c/span\u003e\n            \u003cspan class=\"pl-s1\"\u003ehelperStack\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e.\u003c/span\u003e\u003cspan class=\"pl-en\"\u003epush\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e(\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003es\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e[\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003ei\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e]\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e)\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e;\u003c/span\u003e\n        \u003cspan class=\"pl-kos\"\u003e}\u003c/span\u003e\n        \u003cspan class=\"pl-s1\"\u003ei\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e++\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e;\u003c/span\u003e\n    \u003cspan class=\"pl-kos\"\u003e}\u003c/span\u003e\n    \u003cspan class=\"pl-k\"\u003elet\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eres\u003c/span\u003e: \u003cspan class=\"pl-smi\"\u003estring\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s\"\u003e''\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e;\u003c/span\u003e\n    \u003cspan class=\"pl-k\"\u003ewhile\u003c/span\u003e \u003cspan class=\"pl-kos\"\u003e(\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003ehelperStack\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e.\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003elength\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e\u0026gt;\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e)\u003c/span\u003e \u003cspan class=\"pl-kos\"\u003e{\u003c/span\u003e\n        \u003cspan class=\"pl-s1\"\u003eres\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003ehelperStack\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e.\u003c/span\u003e\u003cspan class=\"pl-en\"\u003epop\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e(\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e)\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e+\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eres\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e;\u003c/span\u003e\n    \u003cspan class=\"pl-kos\"\u003e}\u003c/span\u003e\n    \u003cspan class=\"pl-k\"\u003ereturn\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eres\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e;\u003c/span\u003e\n\u003cspan class=\"pl-kos\"\u003e}\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e;\u003c/span\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eC:\u003c/h3\u003e\u003ca id=\"user-content-c\" class=\"anchor\" aria-label=\"Permalink: C:\" href=\"#c\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e方法一：使用栈\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"char * removeDuplicates(char * s){\n    //求出字符串长度\n    int strLength = strlen(s);\n    //开辟栈空间。栈空间长度应为字符串长度+1（为了存放字符串结束标志'\\0'）\n    char* stack = (char*)malloc(sizeof(char) * strLength + 1);\n    int stackTop = 0;\n\n    int index = 0;\n    //遍历整个字符串\n    while(index \u0026lt; strLength) {\n        //取出当前index对应字母，之后index+1\n        char letter = s[index++];\n        //若栈中有元素，且栈顶字母等于当前字母（两字母相邻）。将栈顶元素弹出\n        if(stackTop \u0026gt; 0 \u0026amp;\u0026amp; letter == stack[stackTop - 1])\n            stackTop--;\n        //否则将字母入栈\n        else\n            stack[stackTop++] = letter;\n    }\n    //存放字符串结束标志'\\0'\n    stack[stackTop] = '\\0';\n    //返回栈本身作为字符串\n    return stack;\n}\"\u003e\u003cpre\u003e\u003cspan class=\"pl-smi\"\u003echar\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e*\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eremoveDuplicates\u003c/span\u003e(\u003cspan class=\"pl-smi\"\u003echar\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e*\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003es\u003c/span\u003e){\n    \u003cspan class=\"pl-c\"\u003e//求出字符串长度\u003c/span\u003e\n    \u003cspan class=\"pl-smi\"\u003eint\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003estrLength\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-en\"\u003estrlen\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003es\u003c/span\u003e);\n    \u003cspan class=\"pl-c\"\u003e//开辟栈空间。栈空间长度应为字符串长度+1（为了存放字符串结束标志'\\0'）\u003c/span\u003e\n    \u003cspan class=\"pl-smi\"\u003echar\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e*\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003estack\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e (\u003cspan class=\"pl-smi\"\u003echar\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e*\u003c/span\u003e)\u003cspan class=\"pl-en\"\u003emalloc\u003c/span\u003e(\u003cspan class=\"pl-k\"\u003esizeof\u003c/span\u003e(\u003cspan class=\"pl-smi\"\u003echar\u003c/span\u003e) \u003cspan class=\"pl-c1\"\u003e*\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003estrLength\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e+\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e);\n    \u003cspan class=\"pl-smi\"\u003eint\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003estackTop\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e;\n\n    \u003cspan class=\"pl-smi\"\u003eint\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eindex\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e;\n    \u003cspan class=\"pl-c\"\u003e//遍历整个字符串\u003c/span\u003e\n    \u003cspan class=\"pl-k\"\u003ewhile\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003eindex\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e\u0026lt;\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003estrLength\u003c/span\u003e) {\n        \u003cspan class=\"pl-c\"\u003e//取出当前index对应字母，之后index+1\u003c/span\u003e\n        \u003cspan class=\"pl-smi\"\u003echar\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eletter\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003es\u003c/span\u003e[\u003cspan class=\"pl-s1\"\u003eindex\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e++\u003c/span\u003e];\n        \u003cspan class=\"pl-c\"\u003e//若栈中有元素，且栈顶字母等于当前字母（两字母相邻）。将栈顶元素弹出\u003c/span\u003e\n        \u003cspan class=\"pl-k\"\u003eif\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003estackTop\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e\u0026gt;\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e\u0026amp;\u0026amp;\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eletter\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e==\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003estack\u003c/span\u003e[\u003cspan class=\"pl-s1\"\u003estackTop\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e-\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e])\n            \u003cspan class=\"pl-s1\"\u003estackTop\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e--\u003c/span\u003e;\n        \u003cspan class=\"pl-c\"\u003e//否则将字母入栈\u003c/span\u003e\n        \u003cspan class=\"pl-k\"\u003eelse\u003c/span\u003e\n            \u003cspan class=\"pl-s1\"\u003estack\u003c/span\u003e[\u003cspan class=\"pl-s1\"\u003estackTop\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e++\u003c/span\u003e] \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eletter\u003c/span\u003e;\n    }\n    \u003cspan class=\"pl-c\"\u003e//存放字符串结束标志'\\0'\u003c/span\u003e\n    \u003cspan class=\"pl-s1\"\u003estack\u003c/span\u003e[\u003cspan class=\"pl-s1\"\u003estackTop\u003c/span\u003e] \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e'\\0'\u003c/span\u003e;\n    \u003cspan class=\"pl-c\"\u003e//返回栈本身作为字符串\u003c/span\u003e\n    \u003cspan class=\"pl-k\"\u003ereturn\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003estack\u003c/span\u003e;\n}\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e方法二：双指针法\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"char * removeDuplicates(char * s){\n    //创建快慢指针\n    int fast = 0;\n    int slow = 0;\n    //求出字符串长度\n    int strLength = strlen(s);\n    //遍历字符串\n    while(fast \u0026lt; strLength) {\n        //将当前slow指向字符改为fast指向字符。fast指针+1\n        char letter = s[slow] = s[fast++];\n        //若慢指针大于0，且慢指针指向元素等于字符串中前一位元素，删除慢指针指向当前元素\n        if(slow \u0026gt; 0 \u0026amp;\u0026amp; letter == s[slow - 1])\n            slow--;\n        else\n            slow++;\n    }\n    //在字符串结束加入字符串结束标志'\\0'\n    s[slow] = 0;\n    return s;\n}\"\u003e\u003cpre\u003e\u003cspan class=\"pl-smi\"\u003echar\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e*\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eremoveDuplicates\u003c/span\u003e(\u003cspan class=\"pl-smi\"\u003echar\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e*\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003es\u003c/span\u003e){\n    \u003cspan class=\"pl-c\"\u003e//创建快慢指针\u003c/span\u003e\n    \u003cspan class=\"pl-smi\"\u003eint\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003efast\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e;\n    \u003cspan class=\"pl-smi\"\u003eint\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eslow\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e;\n    \u003cspan class=\"pl-c\"\u003e//求出字符串长度\u003c/span\u003e\n    \u003cspan class=\"pl-smi\"\u003eint\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003estrLength\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-en\"\u003estrlen\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003es\u003c/span\u003e);\n    \u003cspan class=\"pl-c\"\u003e//遍历字符串\u003c/span\u003e\n    \u003cspan class=\"pl-k\"\u003ewhile\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003efast\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e\u0026lt;\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003estrLength\u003c/span\u003e) {\n        \u003cspan class=\"pl-c\"\u003e//将当前slow指向字符改为fast指向字符。fast指针+1\u003c/span\u003e\n        \u003cspan class=\"pl-smi\"\u003echar\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eletter\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003es\u003c/span\u003e[\u003cspan class=\"pl-s1\"\u003eslow\u003c/span\u003e] \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003es\u003c/span\u003e[\u003cspan class=\"pl-s1\"\u003efast\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e++\u003c/span\u003e];\n        \u003cspan class=\"pl-c\"\u003e//若慢指针大于0，且慢指针指向元素等于字符串中前一位元素，删除慢指针指向当前元素\u003c/span\u003e\n        \u003cspan class=\"pl-k\"\u003eif\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003eslow\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e\u0026gt;\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e\u0026amp;\u0026amp;\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eletter\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e==\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003es\u003c/span\u003e[\u003cspan class=\"pl-s1\"\u003eslow\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e-\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e])\n            \u003cspan class=\"pl-s1\"\u003eslow\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e--\u003c/span\u003e;\n        \u003cspan class=\"pl-k\"\u003eelse\u003c/span\u003e\n            \u003cspan class=\"pl-s1\"\u003eslow\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e++\u003c/span\u003e;\n    }\n    \u003cspan class=\"pl-c\"\u003e//在字符串结束加入字符串结束标志'\\0'\u003c/span\u003e\n    \u003cspan class=\"pl-s1\"\u003es\u003c/span\u003e[\u003cspan class=\"pl-s1\"\u003eslow\u003c/span\u003e] \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e;\n    \u003cspan class=\"pl-k\"\u003ereturn\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003es\u003c/span\u003e;\n}\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eSwift：\u003c/h3\u003e\u003ca id=\"user-content-swift\" class=\"anchor\" aria-label=\"Permalink: Swift：\" href=\"#swift\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"highlight highlight-source-swift notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"func removeDuplicates(_ s: String) -\u0026gt; String {\n    var stack = [Character]()\n    for c in s {\n        if stack.last == c {\n            stack.removeLast()\n        } else {\n            stack.append(c)\n        }\n    }\n    return String(stack)\n}\"\u003e\u003cpre\u003e\u003cspan class=\"pl-en\"\u003efunc\u003c/span\u003e removeDuplicates\u003cspan class=\"pl-kos\"\u003e(\u003c/span\u003e_ s\u003cspan class=\"pl-kos\"\u003e:\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003eString\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e)\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e-\u0026gt;\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003eString\u003c/span\u003e \u003cspan class=\"pl-kos\"\u003e{\u003c/span\u003e\n    \u003cspan class=\"pl-k\"\u003evar\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003estack\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-kos\"\u003e[\u003c/span\u003eCharacter\u003cspan class=\"pl-kos\"\u003e]\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e(\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e)\u003c/span\u003e\n    \u003cspan class=\"pl-k\"\u003efor\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003ec\u003c/span\u003e \u003cspan class=\"pl-k\"\u003ein\u003c/span\u003e s \u003cspan class=\"pl-kos\"\u003e{\u003c/span\u003e\n        \u003cspan class=\"pl-k\"\u003eif\u003c/span\u003e stack\u003cspan class=\"pl-kos\"\u003e.\u003c/span\u003elast \u003cspan class=\"pl-c1\"\u003e==\u003c/span\u003e c \u003cspan class=\"pl-kos\"\u003e{\u003c/span\u003e\n            stack\u003cspan class=\"pl-kos\"\u003e.\u003c/span\u003e\u003cspan class=\"pl-en\"\u003eremoveLast\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e(\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e)\u003c/span\u003e\n        \u003cspan class=\"pl-kos\"\u003e}\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eelse\u003c/span\u003e \u003cspan class=\"pl-kos\"\u003e{\u003c/span\u003e\n            stack\u003cspan class=\"pl-kos\"\u003e.\u003c/span\u003e\u003cspan class=\"pl-en\"\u003eappend\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e(\u003c/span\u003ec\u003cspan class=\"pl-kos\"\u003e)\u003c/span\u003e\n        \u003cspan class=\"pl-kos\"\u003e}\u003c/span\u003e\n    \u003cspan class=\"pl-kos\"\u003e}\u003c/span\u003e\n    \u003cspan class=\"pl-k\"\u003ereturn\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eString\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e(\u003c/span\u003estack\u003cspan class=\"pl-kos\"\u003e)\u003c/span\u003e\n\u003cspan class=\"pl-kos\"\u003e}\u003c/span\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eC#:\u003c/h3\u003e\u003ca id=\"user-content-c-1\" class=\"anchor\" aria-label=\"Permalink: C#:\" href=\"#c-1\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"highlight highlight-source-cs notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"public string RemoveDuplicates(string s) {\n        //拿字符串直接作为栈，省去了栈还要转为字符串的操作\n        StringBuilder res = new StringBuilder();\n\n        foreach(char c in s){\n            if(res.Length \u0026gt; 0 \u0026amp;\u0026amp; res[res.Length-1] == c){\n                res.Remove(res.Length-1, 1);\n            }else{\n                res.Append(c);\n            }\n        }\n       \n        return res.ToString();\n    }\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003epublic\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003estring\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eRemoveDuplicates\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e(\u003c/span\u003e\u003cspan class=\"pl-smi\"\u003estring\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003es\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e)\u003c/span\u003e \u003cspan class=\"pl-kos\"\u003e{\u003c/span\u003e\n        \u003cspan class=\"pl-c\"\u003e//拿字符串直接作为栈，省去了栈还要转为字符串的操作\u003c/span\u003e\n        \u003cspan class=\"pl-smi\"\u003eStringBuilder\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eres\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-k\"\u003enew\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003eStringBuilder\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e(\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e)\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e;\u003c/span\u003e\n\n        \u003cspan class=\"pl-k\"\u003eforeach\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e(\u003c/span\u003e\u003cspan class=\"pl-smi\"\u003echar\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003ec\u003c/span\u003e \u003cspan class=\"pl-k\"\u003ein\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003es\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e)\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e{\u003c/span\u003e\n            \u003cspan class=\"pl-k\"\u003eif\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e(\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003eres\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e.\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003eLength\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e\u0026gt;\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e\u0026amp;\u0026amp;\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eres\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e[\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003eres\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e.\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003eLength\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e-\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e]\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e==\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003ec\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e)\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e{\u003c/span\u003e\n                \u003cspan class=\"pl-s1\"\u003eres\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e.\u003c/span\u003e\u003cspan class=\"pl-en\"\u003eRemove\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e(\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003eres\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e.\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003eLength\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e-\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e,\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e)\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e;\u003c/span\u003e\n            \u003cspan class=\"pl-kos\"\u003e}\u003c/span\u003e\u003cspan class=\"pl-k\"\u003eelse\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e{\u003c/span\u003e\n                \u003cspan class=\"pl-s1\"\u003eres\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e.\u003c/span\u003e\u003cspan class=\"pl-en\"\u003eAppend\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e(\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003ec\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e)\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e;\u003c/span\u003e\n            \u003cspan class=\"pl-kos\"\u003e}\u003c/span\u003e\n        \u003cspan class=\"pl-kos\"\u003e}\u003c/span\u003e\n       \n        \u003cspan class=\"pl-k\"\u003ereturn\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eres\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e.\u003c/span\u003e\u003cspan class=\"pl-en\"\u003eToString\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e(\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e)\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e;\u003c/span\u003e\n    \u003cspan class=\"pl-kos\"\u003e}\u003c/span\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003ePHP:\u003c/h3\u003e\u003ca id=\"user-content-php\" class=\"anchor\" aria-label=\"Permalink: PHP:\" href=\"#php\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"highlight highlight-text-html-php notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"class Solution {\n    function removeDuplicates($s) {\n        $stack = new SplStack();\n        for($i=0;$i\u0026lt;strlen($s);$i++){\n            if($stack-\u0026gt;isEmpty() || $s[$i] != $stack-\u0026gt;top()){\n                $stack-\u0026gt;push($s[$i]);\n            }else{\n               $stack-\u0026gt;pop(); \n            }\n        }\n\n        $result = \u0026quot;\u0026quot;;\n        while(!$stack-\u0026gt;isEmpty()){\n            $result.= $stack-\u0026gt;top();\n            $stack-\u0026gt;pop();\n        }\n        \n        // 此时字符串需要反转一下\n        return strrev($result);\n    }\n}\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003eclass\u003c/span\u003e Solution {\n    \u003cspan class=\"pl-k\"\u003efunction\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eremoveDuplicates\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003es\u003c/span\u003e) {\n        \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003estack\u003c/span\u003e = \u003cspan class=\"pl-k\"\u003enew\u003c/span\u003e \u003cspan class=\"pl-v\"\u003eSplStack\u003c/span\u003e();\n        \u003cspan class=\"pl-k\"\u003efor\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ei\u003c/span\u003e=\u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e;\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ei\u003c/span\u003e\u0026lt;\u003cspan class=\"pl-en\"\u003estrlen\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003es\u003c/span\u003e);\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ei\u003c/span\u003e++){\n            \u003cspan class=\"pl-k\"\u003eif\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003estack\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-en\"\u003eisEmpty\u003c/span\u003e() || \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003es\u003c/span\u003e[\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ei\u003c/span\u003e] != \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003estack\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-en\"\u003etop\u003c/span\u003e()){\n                \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003estack\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-en\"\u003epush\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003es\u003c/span\u003e[\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ei\u003c/span\u003e]);\n            }\u003cspan class=\"pl-k\"\u003eelse\u003c/span\u003e{\n               \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003estack\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-en\"\u003epop\u003c/span\u003e(); \n            }\n        }\n\n        \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003eresult\u003c/span\u003e = \u003cspan class=\"pl-s\"\u003e\"\"\u003c/span\u003e;\n        \u003cspan class=\"pl-k\"\u003ewhile\u003c/span\u003e(!\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003estack\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-en\"\u003eisEmpty\u003c/span\u003e()){\n            \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003eresult\u003c/span\u003e.= \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003estack\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-en\"\u003etop\u003c/span\u003e();\n            \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003estack\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-en\"\u003epop\u003c/span\u003e();\n        }\n        \n        \u003cspan class=\"pl-c\"\u003e// 此时字符串需要反转一下\u003c/span\u003e\n        \u003cspan class=\"pl-k\"\u003ereturn\u003c/span\u003e \u003cspan class=\"pl-en\"\u003estrrev\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003eresult\u003c/span\u003e);\n    }\n}\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eScala:\u003c/h3\u003e\u003ca id=\"user-content-scala\" class=\"anchor\" aria-label=\"Permalink: Scala:\" href=\"#scala\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"highlight highlight-source-scala notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"object Solution {\n  import scala.collection.mutable\n  def removeDuplicates(s: String): String = {\n    var stack = mutable.Stack[Int]()\n    var str = \u0026quot;\u0026quot; // 保存最终结果\n    for (i \u0026lt;- s.indices) {\n      var tmp = s(i)\n      // 如果栈非空并且栈顶元素等于当前字符，那么删掉栈顶和字符串最后一个元素\n      if (!stack.isEmpty \u0026amp;\u0026amp; tmp == stack.head) {\n        str = str.take(str.length - 1)\n        stack.pop()\n      } else {\n        stack.push(tmp)\n        str += tmp\n      }\n    }\n    str\n  }\n}\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003eobject\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eSolution\u003c/span\u003e {\n  \u003cspan class=\"pl-k\"\u003eimport\u003c/span\u003e \u003cspan class=\"pl-en\"\u003escala\u003c/span\u003e.\u003cspan class=\"pl-en\"\u003ecollection\u003c/span\u003e.\u003cspan class=\"pl-en\"\u003emutable\u003c/span\u003e\n  \u003cspan class=\"pl-k\"\u003edef\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eremoveDuplicates\u003c/span\u003e(\u003cspan class=\"pl-v\"\u003es\u003c/span\u003e: \u003cspan class=\"pl-en\"\u003eString\u003c/span\u003e)\u003cspan class=\"pl-k\"\u003e:\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eString\u003c/span\u003e \u003cspan class=\"pl-k\"\u003e=\u003c/span\u003e {\n    \u003cspan class=\"pl-k\"\u003evar\u003c/span\u003e \u003cspan class=\"pl-v\"\u003estack\u003c/span\u003e \u003cspan class=\"pl-k\"\u003e=\u003c/span\u003e mutable.\u003cspan class=\"pl-en\"\u003eStack\u003c/span\u003e[\u003cspan class=\"pl-en\"\u003eInt\u003c/span\u003e]()\n    \u003cspan class=\"pl-k\"\u003evar\u003c/span\u003e \u003cspan class=\"pl-v\"\u003estr\u003c/span\u003e \u003cspan class=\"pl-k\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e 保存最终结果\u003c/span\u003e\n    \u003cspan class=\"pl-k\"\u003efor\u003c/span\u003e (i \u003cspan class=\"pl-k\"\u003e\u0026lt;-\u003c/span\u003e s.indices) {\n      \u003cspan class=\"pl-k\"\u003evar\u003c/span\u003e \u003cspan class=\"pl-v\"\u003etmp\u003c/span\u003e \u003cspan class=\"pl-k\"\u003e=\u003c/span\u003e s(i)\n      \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e 如果栈非空并且栈顶元素等于当前字符，那么删掉栈顶和字符串最后一个元素\u003c/span\u003e\n      \u003cspan class=\"pl-k\"\u003eif\u003c/span\u003e (\u003cspan class=\"pl-k\"\u003e!\u003c/span\u003estack.isEmpty \u003cspan class=\"pl-k\"\u003e\u0026amp;\u0026amp;\u003c/span\u003e tmp \u003cspan class=\"pl-k\"\u003e==\u003c/span\u003e stack.head) {\n        str \u003cspan class=\"pl-k\"\u003e=\u003c/span\u003e str.take(str.length \u003cspan class=\"pl-k\"\u003e-\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e)\n        stack.pop()\n      } \u003cspan class=\"pl-k\"\u003eelse\u003c/span\u003e {\n        stack.push(tmp)\n        str \u003cspan class=\"pl-k\"\u003e+=\u003c/span\u003e tmp\n      }\n    }\n    str\n  }\n}\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eRust:\u003c/h3\u003e\u003ca id=\"user-content-rust\" class=\"anchor\" aria-label=\"Permalink: Rust:\" href=\"#rust\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"highlight highlight-source-rust notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"impl Solution {\n    pub fn remove_duplicates(s: String) -\u0026gt; String {\n        let mut stack = vec![];\n        let mut chars: Vec\u0026lt;char\u0026gt; = s.chars().collect();\n        while let Some(c) = chars.pop() {\n            if stack.is_empty() || stack[stack.len() - 1] != c {\n                stack.push(c);\n            } else {\n                stack.pop();\n            }\n        }\n        stack.into_iter().rev().collect()\n    }\n}\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003eimpl\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003eSolution\u003c/span\u003e \u003cspan class=\"pl-kos\"\u003e{\u003c/span\u003e\n    \u003cspan class=\"pl-k\"\u003epub\u003c/span\u003e \u003cspan class=\"pl-k\"\u003efn\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eremove_duplicates\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e(\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003es\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e:\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003eString\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e)\u003c/span\u003e -\u0026gt; \u003cspan class=\"pl-smi\"\u003eString\u003c/span\u003e \u003cspan class=\"pl-kos\"\u003e{\u003c/span\u003e\n        \u003cspan class=\"pl-k\"\u003elet\u003c/span\u003e \u003cspan class=\"pl-k\"\u003emut\u003c/span\u003e stack = \u003cspan class=\"pl-en\"\u003evec\u003c/span\u003e\u003cspan class=\"pl-en\"\u003e!\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e[\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e]\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e;\u003c/span\u003e\n        \u003cspan class=\"pl-k\"\u003elet\u003c/span\u003e \u003cspan class=\"pl-k\"\u003emut\u003c/span\u003e chars\u003cspan class=\"pl-kos\"\u003e:\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003eVec\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e\u0026lt;\u003c/span\u003e\u003cspan class=\"pl-smi\"\u003echar\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e\u0026gt;\u003c/span\u003e = s\u003cspan class=\"pl-kos\"\u003e.\u003c/span\u003e\u003cspan class=\"pl-en\"\u003echars\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e(\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e)\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e.\u003c/span\u003e\u003cspan class=\"pl-en\"\u003ecollect\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e(\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e)\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e;\u003c/span\u003e\n        \u003cspan class=\"pl-k\"\u003ewhile\u003c/span\u003e \u003cspan class=\"pl-k\"\u003elet\u003c/span\u003e \u003cspan class=\"pl-v\"\u003eSome\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e(\u003c/span\u003ec\u003cspan class=\"pl-kos\"\u003e)\u003c/span\u003e = chars\u003cspan class=\"pl-kos\"\u003e.\u003c/span\u003e\u003cspan class=\"pl-en\"\u003epop\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e(\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e)\u003c/span\u003e \u003cspan class=\"pl-kos\"\u003e{\u003c/span\u003e\n            \u003cspan class=\"pl-k\"\u003eif\u003c/span\u003e stack\u003cspan class=\"pl-kos\"\u003e.\u003c/span\u003e\u003cspan class=\"pl-en\"\u003eis_empty\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e(\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e)\u003c/span\u003e || stack\u003cspan class=\"pl-kos\"\u003e[\u003c/span\u003estack\u003cspan class=\"pl-kos\"\u003e.\u003c/span\u003e\u003cspan class=\"pl-en\"\u003elen\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e(\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e)\u003c/span\u003e - \u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e]\u003c/span\u003e != c \u003cspan class=\"pl-kos\"\u003e{\u003c/span\u003e\n                stack\u003cspan class=\"pl-kos\"\u003e.\u003c/span\u003e\u003cspan class=\"pl-en\"\u003epush\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e(\u003c/span\u003ec\u003cspan class=\"pl-kos\"\u003e)\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e;\u003c/span\u003e\n            \u003cspan class=\"pl-kos\"\u003e}\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eelse\u003c/span\u003e \u003cspan class=\"pl-kos\"\u003e{\u003c/span\u003e\n                stack\u003cspan class=\"pl-kos\"\u003e.\u003c/span\u003e\u003cspan class=\"pl-en\"\u003epop\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e(\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e)\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e;\u003c/span\u003e\n            \u003cspan class=\"pl-kos\"\u003e}\u003c/span\u003e\n        \u003cspan class=\"pl-kos\"\u003e}\u003c/span\u003e\n        stack\u003cspan class=\"pl-kos\"\u003e.\u003c/span\u003e\u003cspan class=\"pl-en\"\u003einto_iter\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e(\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e)\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e.\u003c/span\u003e\u003cspan class=\"pl-en\"\u003erev\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e(\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e)\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e.\u003c/span\u003e\u003cspan class=\"pl-en\"\u003ecollect\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e(\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e)\u003c/span\u003e\n    \u003cspan class=\"pl-kos\"\u003e}\u003c/span\u003e\n\u003cspan class=\"pl-kos\"\u003e}\u003c/span\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eRuby\u003c/h3\u003e\u003ca id=\"user-content-ruby\" class=\"anchor\" aria-label=\"Permalink: Ruby\" href=\"#ruby\"\u003e\u003csvg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"highlight highlight-source-ruby notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"def remove_duplicates(s)\n  #数组模拟栈\n  stack = []\n  s.each_char do |chr|\n    if stack.empty?\n      stack.push chr\n    else\n      head = stack.pop \n      #重新进栈\n      stack.push head, chr if head != chr\n    end\n  end\n\n  return stack.join\nend\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003edef\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eremove_duplicates\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e(\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003es\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e)\u003c/span\u003e\n  \u003cspan class=\"pl-c\"\u003e#数组模拟栈\u003c/span\u003e\n  \u003cspan class=\"pl-s1\"\u003estack\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-kos\"\u003e[\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e]\u003c/span\u003e\n  \u003cspan class=\"pl-s1\"\u003es\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e.\u003c/span\u003e\u003cspan class=\"pl-en\"\u003eeach_char\u003c/span\u003e \u003cspan class=\"pl-k\"\u003edo\u003c/span\u003e |\u003cspan class=\"pl-s1\"\u003echr\u003c/span\u003e|\n    \u003cspan class=\"pl-k\"\u003eif\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003estack\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e.\u003c/span\u003e\u003cspan class=\"pl-en\"\u003eempty?\u003c/span\u003e\n      \u003cspan class=\"pl-s1\"\u003estack\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e.\u003c/span\u003e\u003cspan class=\"pl-en\"\u003epush\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003echr\u003c/span\u003e\n    \u003cspan class=\"pl-k\"\u003eelse\u003c/span\u003e\n      \u003cspan class=\"pl-s1\"\u003ehead\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003estack\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e.\u003c/span\u003e\u003cspan class=\"pl-en\"\u003epop\u003c/span\u003e \n      \u003cspan class=\"pl-c\"\u003e#重新进栈\u003c/span\u003e\n      \u003cspan class=\"pl-s1\"\u003estack\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e.\u003c/span\u003e\u003cspan class=\"pl-en\"\u003epush\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003ehead\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e,\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003echr\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eif\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003ehead\u003c/span\u003e != \u003cspan class=\"pl-s1\"\u003echr\u003c/span\u003e\n    \u003cspan class=\"pl-k\"\u003eend\u003c/span\u003e\n  \u003cspan class=\"pl-k\"\u003eend\u003c/span\u003e\n\n  \u003cspan class=\"pl-k\"\u003ereturn\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003estack\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e.\u003c/span\u003e\u003cspan class=\"pl-en\"\u003ejoin\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003eend\u003c/span\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp align=\"center\" dir=\"auto\"\u003e\n\u003ca href=\"https://programmercarl.com/other/kstar.html\" rel=\"nofollow\"\u003e\n  \u003cimg src=\"/feinan/leetcode-master/raw/master/pics/网站星球宣传海报.jpg\" width=\"1000\" style=\"max-width: 100%;\"\u003e\n\u003c/a\u003e\n\u003c/p\u003e\u003c/article\u003e","richTextTruncated":false,"renderedFileInfo":null,"symbols":{"timed_out":false,"not_analyzed":false,"symbols":[{"name":"1047. 删除字符串中的所有相邻重复项","fully_qualified_name":"1047. 删除字符串中的所有相邻重复项","kind":"section_1","ident_start":378,"ident_end":426,"extent_start":376,"extent_end":14839,"ident_utf16":{"start":{"line_number":9,"utf16_col":2},"end":{"line_number":9,"utf16_col":22}},"extent_utf16":{"start":{"line_number":9,"utf16_col":0},"end":{"line_number":502,"utf16_col":0}}},{"name":"算法公开课","fully_qualified_name":"算法公开课","kind":"section_2","ident_start":1222,"ident_end":1237,"extent_start":1219,"extent_end":1557,"ident_utf16":{"start":{"line_number":30,"utf16_col":3},"end":{"line_number":30,"utf16_col":8}},"extent_utf16":{"start":{"line_number":30,"utf16_col":0},"end":{"line_number":34,"utf16_col":0}}},{"name":"思路","fully_qualified_name":"思路","kind":"section_2","ident_start":1560,"ident_end":1566,"extent_start":1557,"extent_end":5458,"ident_utf16":{"start":{"line_number":34,"utf16_col":3},"end":{"line_number":34,"utf16_col":5}},"extent_utf16":{"start":{"line_number":34,"utf16_col":0},"end":{"line_number":125,"utf16_col":0}}},{"name":"正题","fully_qualified_name":"正题","kind":"section_3","ident_start":1572,"ident_end":1578,"extent_start":1568,"extent_end":3942,"ident_utf16":{"start":{"line_number":36,"utf16_col":4},"end":{"line_number":36,"utf16_col":6}},"extent_utf16":{"start":{"line_number":36,"utf16_col":0},"end":{"line_number":107,"utf16_col":0}}},{"name":"题外话","fully_qualified_name":"题外话","kind":"section_3","ident_start":3946,"ident_end":3955,"extent_start":3942,"extent_end":5458,"ident_utf16":{"start":{"line_number":107,"utf16_col":4},"end":{"line_number":107,"utf16_col":7}},"extent_utf16":{"start":{"line_number":107,"utf16_col":0},"end":{"line_number":125,"utf16_col":0}}},{"name":"其他语言版本","fully_qualified_name":"其他语言版本","kind":"section_2","ident_start":5461,"ident_end":5479,"extent_start":5458,"extent_end":14839,"ident_utf16":{"start":{"line_number":125,"utf16_col":3},"end":{"line_number":125,"utf16_col":9}},"extent_utf16":{"start":{"line_number":125,"utf16_col":0},"end":{"line_number":502,"utf16_col":0}}},{"name":"Java：","fully_qualified_name":"Java：","kind":"section_3","ident_start":5485,"ident_end":5492,"extent_start":5481,"extent_end":7844,"ident_utf16":{"start":{"line_number":127,"utf16_col":4},"end":{"line_number":127,"utf16_col":9}},"extent_utf16":{"start":{"line_number":127,"utf16_col":0},"end":{"line_number":204,"utf16_col":0}}},{"name":"Python：","fully_qualified_name":"Python：","kind":"section_3","ident_start":7848,"ident_end":7857,"extent_start":7844,"extent_end":8829,"ident_utf16":{"start":{"line_number":204,"utf16_col":4},"end":{"line_number":204,"utf16_col":11}},"extent_utf16":{"start":{"line_number":204,"utf16_col":0},"end":{"line_number":241,"utf16_col":0}}},{"name":"Go：","fully_qualified_name":"Go：","kind":"section_3","ident_start":8833,"ident_end":8838,"extent_start":8829,"extent_end":9276,"ident_utf16":{"start":{"line_number":241,"utf16_col":4},"end":{"line_number":241,"utf16_col":7}},"extent_utf16":{"start":{"line_number":241,"utf16_col":0},"end":{"line_number":260,"utf16_col":0}}},{"name":"JavaScript:","fully_qualified_name":"JavaScript:","kind":"section_3","ident_start":9280,"ident_end":9291,"extent_start":9276,"extent_end":10055,"ident_utf16":{"start":{"line_number":260,"utf16_col":4},"end":{"line_number":260,"utf16_col":15}},"extent_utf16":{"start":{"line_number":260,"utf16_col":0},"end":{"line_number":297,"utf16_col":0}}},{"name":"TypeScript：","fully_qualified_name":"TypeScript：","kind":"section_3","ident_start":10059,"ident_end":10072,"extent_start":10055,"extent_end":10559,"ident_utf16":{"start":{"line_number":297,"utf16_col":4},"end":{"line_number":297,"utf16_col":15}},"extent_utf16":{"start":{"line_number":297,"utf16_col":0},"end":{"line_number":320,"utf16_col":0}}},{"name":"C:","fully_qualified_name":"C:","kind":"section_3","ident_start":10563,"ident_end":10565,"extent_start":10559,"extent_end":12136,"ident_utf16":{"start":{"line_number":320,"utf16_col":4},"end":{"line_number":320,"utf16_col":6}},"extent_utf16":{"start":{"line_number":320,"utf16_col":0},"end":{"line_number":373,"utf16_col":0}}},{"name":"Swift：","fully_qualified_name":"Swift：","kind":"section_3","ident_start":12140,"ident_end":12148,"extent_start":12136,"extent_end":12406,"ident_utf16":{"start":{"line_number":373,"utf16_col":4},"end":{"line_number":373,"utf16_col":10}},"extent_utf16":{"start":{"line_number":373,"utf16_col":0},"end":{"line_number":389,"utf16_col":0}}},{"name":"C#:","fully_qualified_name":"C#:","kind":"section_3","ident_start":12410,"ident_end":12413,"extent_start":12406,"extent_end":12858,"ident_utf16":{"start":{"line_number":389,"utf16_col":4},"end":{"line_number":389,"utf16_col":7}},"extent_utf16":{"start":{"line_number":389,"utf16_col":0},"end":{"line_number":408,"utf16_col":0}}},{"name":"PHP:","fully_qualified_name":"PHP:","kind":"section_3","ident_start":12862,"ident_end":12866,"extent_start":12858,"extent_end":13404,"ident_utf16":{"start":{"line_number":408,"utf16_col":4},"end":{"line_number":408,"utf16_col":8}},"extent_utf16":{"start":{"line_number":408,"utf16_col":0},"end":{"line_number":434,"utf16_col":0}}},{"name":"Scala:","fully_qualified_name":"Scala:","kind":"section_3","ident_start":13408,"ident_end":13414,"extent_start":13404,"extent_end":13958,"ident_utf16":{"start":{"line_number":434,"utf16_col":4},"end":{"line_number":434,"utf16_col":10}},"extent_utf16":{"start":{"line_number":434,"utf16_col":0},"end":{"line_number":458,"utf16_col":0}}},{"name":"Rust:","fully_qualified_name":"Rust:","kind":"section_3","ident_start":13962,"ident_end":13967,"extent_start":13958,"extent_end":14400,"ident_utf16":{"start":{"line_number":458,"utf16_col":4},"end":{"line_number":458,"utf16_col":9}},"extent_utf16":{"start":{"line_number":458,"utf16_col":0},"end":{"line_number":477,"utf16_col":0}}},{"name":"Ruby","fully_qualified_name":"Ruby","kind":"section_3","ident_start":14404,"ident_end":14408,"extent_start":14400,"extent_end":14839,"ident_utf16":{"start":{"line_number":477,"utf16_col":4},"end":{"line_number":477,"utf16_col":8}},"extent_utf16":{"start":{"line_number":477,"utf16_col":0},"end":{"line_number":502,"utf16_col":0}}}]}},"codeViewLayoutRoute":{"repo":{"id":793905675,"defaultBranch":"master","name":"leetcode-master","ownerLogin":"feinan","currentUserCanPush":false,"isFork":true,"isEmpty":false,"createdAt":"2024-04-30T05:06:31.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/1912535?v=4","public":true,"private":false,"isOrgOwned":false,"isArchived":false},"currentUser":null,"uploadToken":"ztlaLZ57I9d9atEMxwaaHFI3f5aQ0u4SQD28u3-O9Wx-0bZqOb3375rMPQUZu13dLUJ43cO8u4wmzV4dsXNMeg","allShortcutsEnabled":false,"treeExpanded":true,"path":"problems/1047.删除字符串中的所有相邻重复项.md","symbolsExpanded":false,"refInfo":{"name":"master","listCacheKey":"v0:1714453598.065801","canEdit":false,"currentOid":"b07e850a199dae1777d8831e9e811d87725396b4"},"helpUrl":"https://docs.github.com","githubDevUrl":null},"codeViewFileTreeLayoutRoute":{"fileTree":{"problems":{"items":[{"name":"kamacoder","path":"problems/kamacoder","contentType":"directory"},{"name":"qita","path":"problems/qita","contentType":"directory"},{"name":"前序","path":"problems/前序","contentType":"directory"},{"name":"周总结","path":"problems/周总结","contentType":"directory"},{"name":"0001.两数之和.md","path":"problems/0001.两数之和.md","contentType":"file"},{"name":"0005.最长回文子串.md","path":"problems/0005.最长回文子串.md","contentType":"file"},{"name":"0015.三数之和.md","path":"problems/0015.三数之和.md","contentType":"file"},{"name":"0017.电话号码的字母组合.md","path":"problems/0017.电话号码的字母组合.md","contentType":"file"},{"name":"0018.四数之和.md","path":"problems/0018.四数之和.md","contentType":"file"},{"name":"0019.删除链表的倒数第N个节点.md","path":"problems/0019.删除链表的倒数第N个节点.md","contentType":"file"},{"name":"0020.有效的括号.md","path":"problems/0020.有效的括号.md","contentType":"file"},{"name":"0024.两两交换链表中的节点.md","path":"problems/0024.两两交换链表中的节点.md","contentType":"file"},{"name":"0027.移除元素.md","path":"problems/0027.移除元素.md","contentType":"file"},{"name":"0028.实现strStr.md","path":"problems/0028.实现strStr.md","contentType":"file"},{"name":"0031.下一个排列.md","path":"problems/0031.下一个排列.md","contentType":"file"},{"name":"0034.在排序数组中查找元素的第一个和最后一个位置.md","path":"problems/0034.在排序数组中查找元素的第一个和最后一个位置.md","contentType":"file"},{"name":"0035.搜索插入位置.md","path":"problems/0035.搜索插入位置.md","contentType":"file"},{"name":"0037.解数独.md","path":"problems/0037.解数独.md","contentType":"file"},{"name":"0039.组合总和.md","path":"problems/0039.组合总和.md","contentType":"file"},{"name":"0040.组合总和II.md","path":"problems/0040.组合总和II.md","contentType":"file"},{"name":"0042.接雨水.md","path":"problems/0042.接雨水.md","contentType":"file"},{"name":"0045.跳跃游戏II.md","path":"problems/0045.跳跃游戏II.md","contentType":"file"},{"name":"0046.全排列.md","path":"problems/0046.全排列.md","contentType":"file"},{"name":"0047.全排列II.md","path":"problems/0047.全排列II.md","contentType":"file"},{"name":"0051.N皇后.md","path":"problems/0051.N皇后.md","contentType":"file"},{"name":"0052.N皇后II.md","path":"problems/0052.N皇后II.md","contentType":"file"},{"name":"0053.最大子序和.md","path":"problems/0053.最大子序和.md","contentType":"file"},{"name":"0053.最大子序和（动态规划）.md","path":"problems/0053.最大子序和（动态规划）.md","contentType":"file"},{"name":"0054.螺旋矩阵.md","path":"problems/0054.螺旋矩阵.md","contentType":"file"},{"name":"0055.跳跃游戏.md","path":"problems/0055.跳跃游戏.md","contentType":"file"},{"name":"0056.合并区间.md","path":"problems/0056.合并区间.md","contentType":"file"},{"name":"0059.螺旋矩阵II.md","path":"problems/0059.螺旋矩阵II.md","contentType":"file"},{"name":"0062.不同路径.md","path":"problems/0062.不同路径.md","contentType":"file"},{"name":"0063.不同路径II.md","path":"problems/0063.不同路径II.md","contentType":"file"},{"name":"0070.爬楼梯.md","path":"problems/0070.爬楼梯.md","contentType":"file"},{"name":"0070.爬楼梯完全背包版本.md","path":"problems/0070.爬楼梯完全背包版本.md","contentType":"file"},{"name":"0072.编辑距离.md","path":"problems/0072.编辑距离.md","contentType":"file"},{"name":"0077.组合.md","path":"problems/0077.组合.md","contentType":"file"},{"name":"0077.组合优化.md","path":"problems/0077.组合优化.md","contentType":"file"},{"name":"0078.子集.md","path":"problems/0078.子集.md","contentType":"file"},{"name":"0084.柱状图中最大的矩形.md","path":"problems/0084.柱状图中最大的矩形.md","contentType":"file"},{"name":"0090.子集II.md","path":"problems/0090.子集II.md","contentType":"file"},{"name":"0093.复原IP地址.md","path":"problems/0093.复原IP地址.md","contentType":"file"},{"name":"0096.不同的二叉搜索树.md","path":"problems/0096.不同的二叉搜索树.md","contentType":"file"},{"name":"0098.验证二叉搜索树.md","path":"problems/0098.验证二叉搜索树.md","contentType":"file"},{"name":"0100.相同的树.md","path":"problems/0100.相同的树.md","contentType":"file"},{"name":"0101.对称二叉树.md","path":"problems/0101.对称二叉树.md","contentType":"file"},{"name":"0102.二叉树的层序遍历.md","path":"problems/0102.二叉树的层序遍历.md","contentType":"file"},{"name":"0104.二叉树的最大深度.md","path":"problems/0104.二叉树的最大深度.md","contentType":"file"},{"name":"0106.从中序与后序遍历序列构造二叉树.md","path":"problems/0106.从中序与后序遍历序列构造二叉树.md","contentType":"file"},{"name":"0108.将有序数组转换为二叉搜索树.md","path":"problems/0108.将有序数组转换为二叉搜索树.md","contentType":"file"},{"name":"0110.平衡二叉树.md","path":"problems/0110.平衡二叉树.md","contentType":"file"},{"name":"0111.二叉树的最小深度.md","path":"problems/0111.二叉树的最小深度.md","contentType":"file"},{"name":"0112.路径总和.md","path":"problems/0112.路径总和.md","contentType":"file"},{"name":"0115.不同的子序列.md","path":"problems/0115.不同的子序列.md","contentType":"file"},{"name":"0116.填充每个节点的下一个右侧节点指针.md","path":"problems/0116.填充每个节点的下一个右侧节点指针.md","contentType":"file"},{"name":"0121.买卖股票的最佳时机.md","path":"problems/0121.买卖股票的最佳时机.md","contentType":"file"},{"name":"0122.买卖股票的最佳时机II.md","path":"problems/0122.买卖股票的最佳时机II.md","contentType":"file"},{"name":"0122.买卖股票的最佳时机II（动态规划）.md","path":"problems/0122.买卖股票的最佳时机II（动态规划）.md","contentType":"file"},{"name":"0123.买卖股票的最佳时机III.md","path":"problems/0123.买卖股票的最佳时机III.md","contentType":"file"},{"name":"0127.单词接龙.md","path":"problems/0127.单词接龙.md","contentType":"file"},{"name":"0129.求根到叶子节点数字之和.md","path":"problems/0129.求根到叶子节点数字之和.md","contentType":"file"},{"name":"0130.被围绕的区域.md","path":"problems/0130.被围绕的区域.md","contentType":"file"},{"name":"0131.分割回文串.md","path":"problems/0131.分割回文串.md","contentType":"file"},{"name":"0132.分割回文串II.md","path":"problems/0132.分割回文串II.md","contentType":"file"},{"name":"0134.加油站.md","path":"problems/0134.加油站.md","contentType":"file"},{"name":"0135.分发糖果.md","path":"problems/0135.分发糖果.md","contentType":"file"},{"name":"0139.单词拆分.md","path":"problems/0139.单词拆分.md","contentType":"file"},{"name":"0141.环形链表.md","path":"problems/0141.环形链表.md","contentType":"file"},{"name":"0142.环形链表II.md","path":"problems/0142.环形链表II.md","contentType":"file"},{"name":"0143.重排链表.md","path":"problems/0143.重排链表.md","contentType":"file"},{"name":"0150.逆波兰表达式求值.md","path":"problems/0150.逆波兰表达式求值.md","contentType":"file"},{"name":"0151.翻转字符串里的单词.md","path":"problems/0151.翻转字符串里的单词.md","contentType":"file"},{"name":"0160.相交链表.md","path":"problems/0160.相交链表.md","contentType":"file"},{"name":"0188.买卖股票的最佳时机IV.md","path":"problems/0188.买卖股票的最佳时机IV.md","contentType":"file"},{"name":"0189.旋转数组.md","path":"problems/0189.旋转数组.md","contentType":"file"},{"name":"0198.打家劫舍.md","path":"problems/0198.打家劫舍.md","contentType":"file"},{"name":"0200.岛屿数量.广搜版.md","path":"problems/0200.岛屿数量.广搜版.md","contentType":"file"},{"name":"0200.岛屿数量.深搜版.md","path":"problems/0200.岛屿数量.深搜版.md","contentType":"file"},{"name":"0202.快乐数.md","path":"problems/0202.快乐数.md","contentType":"file"},{"name":"0203.移除链表元素.md","path":"problems/0203.移除链表元素.md","contentType":"file"},{"name":"0205.同构字符串.md","path":"problems/0205.同构字符串.md","contentType":"file"},{"name":"0206.翻转链表.md","path":"problems/0206.翻转链表.md","contentType":"file"},{"name":"0207.课程表.md","path":"problems/0207.课程表.md","contentType":"file"},{"name":"0209.长度最小的子数组.md","path":"problems/0209.长度最小的子数组.md","contentType":"file"},{"name":"0213.打家劫舍II.md","path":"problems/0213.打家劫舍II.md","contentType":"file"},{"name":"0216.组合总和III.md","path":"problems/0216.组合总和III.md","contentType":"file"},{"name":"0222.完全二叉树的节点个数.md","path":"problems/0222.完全二叉树的节点个数.md","contentType":"file"},{"name":"0225.用队列实现栈.md","path":"problems/0225.用队列实现栈.md","contentType":"file"},{"name":"0226.翻转二叉树.md","path":"problems/0226.翻转二叉树.md","contentType":"file"},{"name":"0232.用栈实现队列.md","path":"problems/0232.用栈实现队列.md","contentType":"file"},{"name":"0234.回文链表.md","path":"problems/0234.回文链表.md","contentType":"file"},{"name":"0235.二叉搜索树的最近公共祖先.md","path":"problems/0235.二叉搜索树的最近公共祖先.md","contentType":"file"},{"name":"0236.二叉树的最近公共祖先.md","path":"problems/0236.二叉树的最近公共祖先.md","contentType":"file"},{"name":"0239.滑动窗口最大值.md","path":"problems/0239.滑动窗口最大值.md","contentType":"file"},{"name":"0242.有效的字母异位词.md","path":"problems/0242.有效的字母异位词.md","contentType":"file"},{"name":"0257.二叉树的所有路径.md","path":"problems/0257.二叉树的所有路径.md","contentType":"file"},{"name":"0279.完全平方数.md","path":"problems/0279.完全平方数.md","contentType":"file"},{"name":"0283.移动零.md","path":"problems/0283.移动零.md","contentType":"file"},{"name":"0300.最长上升子序列.md","path":"problems/0300.最长上升子序列.md","contentType":"file"},{"name":"0309.最佳买卖股票时机含冷冻期.md","path":"problems/0309.最佳买卖股票时机含冷冻期.md","contentType":"file"},{"name":"0322.零钱兑换.md","path":"problems/0322.零钱兑换.md","contentType":"file"},{"name":"0332.重新安排行程.md","path":"problems/0332.重新安排行程.md","contentType":"file"},{"name":"0337.打家劫舍III.md","path":"problems/0337.打家劫舍III.md","contentType":"file"},{"name":"0343.整数拆分.md","path":"problems/0343.整数拆分.md","contentType":"file"},{"name":"0344.反转字符串.md","path":"problems/0344.反转字符串.md","contentType":"file"},{"name":"0347.前K个高频元素.md","path":"problems/0347.前K个高频元素.md","contentType":"file"},{"name":"0349.两个数组的交集.md","path":"problems/0349.两个数组的交集.md","contentType":"file"},{"name":"0376.摆动序列.md","path":"problems/0376.摆动序列.md","contentType":"file"},{"name":"0377.组合总和Ⅳ.md","path":"problems/0377.组合总和Ⅳ.md","contentType":"file"},{"name":"0383.赎金信.md","path":"problems/0383.赎金信.md","contentType":"file"},{"name":"0392.判断子序列.md","path":"problems/0392.判断子序列.md","contentType":"file"},{"name":"0404.左叶子之和.md","path":"problems/0404.左叶子之和.md","contentType":"file"},{"name":"0406.根据身高重建队列.md","path":"problems/0406.根据身高重建队列.md","contentType":"file"},{"name":"0416.分割等和子集.md","path":"problems/0416.分割等和子集.md","contentType":"file"},{"name":"0417.太平洋大西洋水流问题.md","path":"problems/0417.太平洋大西洋水流问题.md","contentType":"file"},{"name":"0435.无重叠区间.md","path":"problems/0435.无重叠区间.md","contentType":"file"},{"name":"0450.删除二叉搜索树中的节点.md","path":"problems/0450.删除二叉搜索树中的节点.md","contentType":"file"},{"name":"0452.用最少数量的箭引爆气球.md","path":"problems/0452.用最少数量的箭引爆气球.md","contentType":"file"},{"name":"0454.四数相加II.md","path":"problems/0454.四数相加II.md","contentType":"file"},{"name":"0455.分发饼干.md","path":"problems/0455.分发饼干.md","contentType":"file"},{"name":"0459.重复的子字符串.md","path":"problems/0459.重复的子字符串.md","contentType":"file"},{"name":"0463.岛屿的周长.md","path":"problems/0463.岛屿的周长.md","contentType":"file"},{"name":"0474.一和零.md","path":"problems/0474.一和零.md","contentType":"file"},{"name":"0491.递增子序列.md","path":"problems/0491.递增子序列.md","contentType":"file"},{"name":"0494.目标和.md","path":"problems/0494.目标和.md","contentType":"file"},{"name":"0496.下一个更大元素I.md","path":"problems/0496.下一个更大元素I.md","contentType":"file"},{"name":"0501.二叉搜索树中的众数.md","path":"problems/0501.二叉搜索树中的众数.md","contentType":"file"},{"name":"0503.下一个更大元素II.md","path":"problems/0503.下一个更大元素II.md","contentType":"file"},{"name":"0509.斐波那契数.md","path":"problems/0509.斐波那契数.md","contentType":"file"},{"name":"0513.找树左下角的值.md","path":"problems/0513.找树左下角的值.md","contentType":"file"},{"name":"0516.最长回文子序列.md","path":"problems/0516.最长回文子序列.md","contentType":"file"},{"name":"0518.零钱兑换II.md","path":"problems/0518.零钱兑换II.md","contentType":"file"},{"name":"0530.二叉搜索树的最小绝对差.md","path":"problems/0530.二叉搜索树的最小绝对差.md","contentType":"file"},{"name":"0538.把二叉搜索树转换为累加树.md","path":"problems/0538.把二叉搜索树转换为累加树.md","contentType":"file"},{"name":"0541.反转字符串II.md","path":"problems/0541.反转字符串II.md","contentType":"file"},{"name":"0583.两个字符串的删除操作.md","path":"problems/0583.两个字符串的删除操作.md","contentType":"file"},{"name":"0617.合并二叉树.md","path":"problems/0617.合并二叉树.md","contentType":"file"},{"name":"0647.回文子串.md","path":"problems/0647.回文子串.md","contentType":"file"},{"name":"0649.Dota2参议院.md","path":"problems/0649.Dota2参议院.md","contentType":"file"},{"name":"0654.最大二叉树.md","path":"problems/0654.最大二叉树.md","contentType":"file"},{"name":"0657.机器人能否返回原点.md","path":"problems/0657.机器人能否返回原点.md","contentType":"file"},{"name":"0669.修剪二叉搜索树.md","path":"problems/0669.修剪二叉搜索树.md","contentType":"file"},{"name":"0673.最长递增子序列的个数.md","path":"problems/0673.最长递增子序列的个数.md","contentType":"file"},{"name":"0674.最长连续递增序列.md","path":"problems/0674.最长连续递增序列.md","contentType":"file"},{"name":"0684.冗余连接.md","path":"problems/0684.冗余连接.md","contentType":"file"},{"name":"0685.冗余连接II.md","path":"problems/0685.冗余连接II.md","contentType":"file"},{"name":"0695.岛屿的最大面积.md","path":"problems/0695.岛屿的最大面积.md","contentType":"file"},{"name":"0700.二叉搜索树中的搜索.md","path":"problems/0700.二叉搜索树中的搜索.md","contentType":"file"},{"name":"0701.二叉搜索树中的插入操作.md","path":"problems/0701.二叉搜索树中的插入操作.md","contentType":"file"},{"name":"0704.二分查找.md","path":"problems/0704.二分查找.md","contentType":"file"},{"name":"0707.设计链表.md","path":"problems/0707.设计链表.md","contentType":"file"},{"name":"0714.买卖股票的最佳时机含手续费.md","path":"problems/0714.买卖股票的最佳时机含手续费.md","contentType":"file"},{"name":"0714.买卖股票的最佳时机含手续费（动态规划）.md","path":"problems/0714.买卖股票的最佳时机含手续费（动态规划）.md","contentType":"file"},{"name":"0718.最长重复子数组.md","path":"problems/0718.最长重复子数组.md","contentType":"file"},{"name":"0724.寻找数组的中心索引.md","path":"problems/0724.寻找数组的中心索引.md","contentType":"file"},{"name":"0738.单调递增的数字.md","path":"problems/0738.单调递增的数字.md","contentType":"file"},{"name":"0739.每日温度.md","path":"problems/0739.每日温度.md","contentType":"file"},{"name":"0743.网络延迟时间.md","path":"problems/0743.网络延迟时间.md","contentType":"file"},{"name":"0746.使用最小花费爬楼梯.md","path":"problems/0746.使用最小花费爬楼梯.md","contentType":"file"},{"name":"0763.划分字母区间.md","path":"problems/0763.划分字母区间.md","contentType":"file"},{"name":"0787.K站中转内最便宜的航班.md","path":"problems/0787.K站中转内最便宜的航班.md","contentType":"file"},{"name":"0797.所有可能的路径.md","path":"problems/0797.所有可能的路径.md","contentType":"file"},{"name":"0827.最大人工岛.md","path":"problems/0827.最大人工岛.md","contentType":"file"},{"name":"0841.钥匙和房间.md","path":"problems/0841.钥匙和房间.md","contentType":"file"},{"name":"0844.比较含退格的字符串.md","path":"problems/0844.比较含退格的字符串.md","contentType":"file"},{"name":"0860.柠檬水找零.md","path":"problems/0860.柠檬水找零.md","contentType":"file"},{"name":"0922.按奇偶排序数组II.md","path":"problems/0922.按奇偶排序数组II.md","contentType":"file"},{"name":"0925.长按键入.md","path":"problems/0925.长按键入.md","contentType":"file"},{"name":"0941.有效的山脉数组.md","path":"problems/0941.有效的山脉数组.md","contentType":"file"},{"name":"0968.监控二叉树.md","path":"problems/0968.监控二叉树.md","contentType":"file"},{"name":"0977.有序数组的平方.md","path":"problems/0977.有序数组的平方.md","contentType":"file"},{"name":"1002.查找常用字符.md","path":"problems/1002.查找常用字符.md","contentType":"file"},{"name":"1005.K次取反后最大化的数组和.md","path":"problems/1005.K次取反后最大化的数组和.md","contentType":"file"},{"name":"1020.飞地的数量.md","path":"problems/1020.飞地的数量.md","contentType":"file"},{"name":"1035.不相交的线.md","path":"problems/1035.不相交的线.md","contentType":"file"},{"name":"1047.删除字符串中的所有相邻重复项.md","path":"problems/1047.删除字符串中的所有相邻重复项.md","contentType":"file"},{"name":"1049.最后一块石头的重量II.md","path":"problems/1049.最后一块石头的重量II.md","contentType":"file"},{"name":"1143.最长公共子序列.md","path":"problems/1143.最长公共子序列.md","contentType":"file"},{"name":"1207.独一无二的出现次数.md","path":"problems/1207.独一无二的出现次数.md","contentType":"file"},{"name":"1221.分割平衡字符串.md","path":"problems/1221.分割平衡字符串.md","contentType":"file"},{"name":"1254.统计封闭岛屿的数目.md","path":"problems/1254.统计封闭岛屿的数目.md","contentType":"file"},{"name":"1334.阈值距离内邻居最少的城市.md","path":"problems/1334.阈值距离内邻居最少的城市.md","contentType":"file"},{"name":"1356.根据数字二进制下1的数目排序.md","path":"problems/1356.根据数字二进制下1的数目排序.md","contentType":"file"},{"name":"1365.有多少小于当前数字的数字.md","path":"problems/1365.有多少小于当前数字的数字.md","contentType":"file"},{"name":"1382.将二叉搜索树变平衡.md","path":"problems/1382.将二叉搜索树变平衡.md","contentType":"file"},{"name":"1791.找出星型图的中心节点.md","path":"problems/1791.找出星型图的中心节点.md","contentType":"file"},{"name":"1971.寻找图中是否存在路径.md","path":"problems/1971.寻找图中是否存在路径.md","contentType":"file"},{"name":"O(n)的算法居然超时了，此时的n究竟是多大？.md","path":"problems/O(n)的算法居然超时了，此时的n究竟是多大？.md","contentType":"file"},{"name":"toolgithub.sh","path":"problems/toolgithub.sh","contentType":"file"},{"name":"为了绝杀编辑距离，卡尔做了三步铺垫.md","path":"problems/为了绝杀编辑距离，卡尔做了三步铺垫.md","contentType":"file"},{"name":"二叉树中递归带着回溯.md","path":"problems/二叉树中递归带着回溯.md","contentType":"file"},{"name":"二叉树总结篇.md","path":"problems/二叉树总结篇.md","contentType":"file"},{"name":"二叉树理论基础.md","path":"problems/二叉树理论基础.md","contentType":"file"},{"name":"二叉树的统一迭代法.md","path":"problems/二叉树的统一迭代法.md","contentType":"file"},{"name":"二叉树的迭代遍历.md","path":"problems/二叉树的迭代遍历.md","contentType":"file"},{"name":"二叉树的递归遍历.md","path":"problems/二叉树的递归遍历.md","contentType":"file"},{"name":"剑指Offer05.替换空格.md","path":"problems/剑指Offer05.替换空格.md","contentType":"file"},{"name":"剑指Offer58-II.左旋转字符串.md","path":"problems/剑指Offer58-II.左旋转字符串.md","contentType":"file"},{"name":"动态规划-股票问题总结篇.md","path":"problems/动态规划-股票问题总结篇.md","contentType":"file"},{"name":"动态规划总结篇.md","path":"problems/动态规划总结篇.md","contentType":"file"},{"name":"动态规划理论基础.md","path":"problems/动态规划理论基础.md","contentType":"file"},{"name":"双指针总结.md","path":"problems/双指针总结.md","contentType":"file"},{"name":"哈希表总结.md","path":"problems/哈希表总结.md","contentType":"file"},{"name":"哈希表理论基础.md","path":"problems/哈希表理论基础.md","contentType":"file"},{"name":"回溯总结.md","path":"problems/回溯总结.md","contentType":"file"},{"name":"回溯算法去重问题的另一种写法.md","path":"problems/回溯算法去重问题的另一种写法.md","contentType":"file"},{"name":"回溯算法理论基础.md","path":"problems/回溯算法理论基础.md","contentType":"file"},{"name":"图论并查集理论基础.md","path":"problems/图论并查集理论基础.md","contentType":"file"},{"name":"图论广搜理论基础.md","path":"problems/图论广搜理论基础.md","contentType":"file"},{"name":"图论深搜理论基础.md","path":"problems/图论深搜理论基础.md","contentType":"file"},{"name":"字符串总结.md","path":"problems/字符串总结.md","contentType":"file"},{"name":"数组总结篇.md","path":"problems/数组总结篇.md","contentType":"file"},{"name":"数组理论基础.md","path":"problems/数组理论基础.md","contentType":"file"},{"name":"栈与队列总结.md","path":"problems/栈与队列总结.md","contentType":"file"},{"name":"栈与队列理论基础.md","path":"problems/栈与队列理论基础.md","contentType":"file"},{"name":"根据身高重建队列（vector原理讲解）.md","path":"problems/根据身高重建队列（vector原理讲解）.md","contentType":"file"},{"name":"算法模板.md","path":"problems/算法模板.md","contentType":"file"},{"name":"背包总结篇.md","path":"problems/背包总结篇.md","contentType":"file"},{"name":"背包理论基础01背包-1.md","path":"problems/背包理论基础01背包-1.md","contentType":"file"},{"name":"背包理论基础01背包-2.md","path":"problems/背包理论基础01背包-2.md","contentType":"file"},{"name":"背包问题理论基础多重背包.md","path":"problems/背包问题理论基础多重背包.md","contentType":"file"},{"name":"背包问题理论基础完全背包.md","path":"problems/背包问题理论基础完全背包.md","contentType":"file"},{"name":"贪心算法总结篇.md","path":"problems/贪心算法总结篇.md","contentType":"file"},{"name":"贪心算法理论基础.md","path":"problems/贪心算法理论基础.md","contentType":"file"},{"name":"链表总结篇.md","path":"problems/链表总结篇.md","contentType":"file"},{"name":"链表理论基础.md","path":"problems/链表理论基础.md","contentType":"file"},{"name":"面试题02.07.链表相交.md","path":"problems/面试题02.07.链表相交.md","contentType":"file"}],"totalCount":228},"":{"items":[{"name":"pics","path":"pics","contentType":"directory"},{"name":"problems","path":"problems","contentType":"directory"},{"name":"README.md","path":"README.md","contentType":"file"}],"totalCount":3}},"fileTreeProcessingTime":23.941033,"foldersToFetch":[]},"codeViewBlobLayoutRoute":{"codeLineWrapEnabled":false,"refInfo":{"name":"master","listCacheKey":"v0:1714453598.065801","canEdit":false,"refType":"branch","currentOid":"b07e850a199dae1777d8831e9e811d87725396b4","canEditOnDefaultBranch":false,"fileExistsOnDefault":true},"path":"problems/1047.删除字符串中的所有相邻重复项.md","blob":{"copilotSWEAgentEnabled":false,"dependabotInfo":{"showConfigurationBanner":false,"configFilePath":null,"networkDependabotPath":"/feinan/leetcode-master/network/updates","dismissConfigurationNoticePath":"/settings/dismiss-notice/dependabot_configuration_notice","configurationNoticeDismissed":null},"displayName":"1047.删除字符串中的所有相邻重复项.md","displayUrl":"https://github.com/feinan/leetcode-master/blob/master/problems/1047.%E5%88%A0%E9%99%A4%E5%AD%97%E7%AC%A6%E4%B8%B2%E4%B8%AD%E7%9A%84%E6%89%80%E6%9C%89%E7%9B%B8%E9%82%BB%E9%87%8D%E5%A4%8D%E9%A1%B9.md?raw=true","headerInfo":{"blobSize":"14.5 KB","deleteTooltip":"You must be signed in to make or propose changes","editTooltip":"You must be signed in to make or propose changes","ghDesktopPath":"https://desktop.github.com","isGitLfs":false,"onBranch":true,"shortPath":"4aa0e95","siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2Ffeinan%2Fleetcode-master%2Fblob%2Fmaster%2Fproblems%2F1047.%25E5%2588%25A0%25E9%2599%25A4%25E5%25AD%2597%25E7%25AC%25A6%25E4%25B8%25B2%25E4%25B8%25AD%25E7%259A%2584%25E6%2589%2580%25E6%259C%2589%25E7%259B%25B8%25E9%2582%25BB%25E9%2587%258D%25E5%25A4%258D%25E9%25A1%25B9.md","isCSV":false,"isRichtext":true,"lineInfo":{"truncatedLoc":"502","truncatedSloc":"421"},"mode":"file"},"image":false,"isCodeownersFile":null,"isPlain":false,"isValidLegacyIssueTemplate":false,"isIssueTemplate":false,"isDiscussionTemplate":false,"language":"Markdown","languageID":222,"large":false,"planSupportInfo":{"repoIsFork":null,"repoOwnedByCurrentUser":null,"requestFullPath":"/feinan/leetcode-master/blob/master/problems/1047.%E5%88%A0%E9%99%A4%E5%AD%97%E7%AC%A6%E4%B8%B2%E4%B8%AD%E7%9A%84%E6%89%80%E6%9C%89%E7%9B%B8%E9%82%BB%E9%87%8D%E5%A4%8D%E9%A1%B9.md","showFreeOrgGatedFeatureMessage":null,"showPlanSupportBanner":null,"upgradeDataAttributes":null,"upgradePath":null},"publishBannersInfo":{"dismissActionNoticePath":"/settings/dismiss-notice/publish_action_from_dockerfile","releasePath":"/feinan/leetcode-master/releases/new?marketplace=true","showPublishActionBanner":false},"rawBlobUrl":"https://github.com/feinan/leetcode-master/raw/refs/heads/master/problems/1047.%E5%88%A0%E9%99%A4%E5%AD%97%E7%AC%A6%E4%B8%B2%E4%B8%AD%E7%9A%84%E6%89%80%E6%9C%89%E7%9B%B8%E9%82%BB%E9%87%8D%E5%A4%8D%E9%A1%B9.md","renderImageOrRaw":false,"shortPath":null,"symbolsEnabled":true,"tabSize":4,"topBannersInfo":{"overridingGlobalFundingFile":false,"globalPreferredFundingPath":null,"showInvalidCitationWarning":false,"citationHelpUrl":"https://docs.github.com/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-citation-files","actionsOnboardingTip":null},"truncated":false,"viewable":true,"workflowRedirectUrl":null},"copilotInfo":null,"copilotAccessAllowed":false,"copilotSpacesEnabled":false,"modelsAccessAllowed":false,"modelsRepoIntegrationEnabled":false,"isMarketplaceEnabled":true},"codeViewBlobLayoutRoute.StyledBlob":{"rawLines":["\u003cp align=\"center\"\u003e","\u003ca href=\"https://www.programmercarl.com/xunlian/xunlianying.html\" target=\"_blank\"\u003e","  \u003cimg src=\"../pics/训练营.png\" width=\"1000\"/\u003e","\u003c/a\u003e","\u003cp align=\"center\"\u003e\u003cstrong\u003e\u003ca href=\"./qita/join.md\"\u003e参与本项目\u003c/a\u003e，贡献其他语言版本的代码，拥抱开源，让更多学习算法的小伙伴们受益！\u003c/strong\u003e\u003c/p\u003e","","","\u003e 匹配问题都是栈的强项","","# 1047. 删除字符串中的所有相邻重复项","","[力扣题目链接](https://leetcode.cn/problems/remove-all-adjacent-duplicates-in-string/)","","给出由小写字母组成的字符串 S，重复项删除操作会选择两个相邻且相同的字母，并删除它们。","","在 S 上反复执行重复项删除操作，直到无法继续删除。","","在完成所有重复项删除操作后返回最终的字符串。答案保证唯一。","","","示例：","* 输入：\"abbaca\"","* 输出：\"ca\"","* 解释：例如，在 \"abbaca\" 中，我们可以删除 \"bb\" 由于两字母相邻且相同，这是此时唯一可以执行删除操作的重复项。之后我们得到字符串 \"aaca\"，其中又只有 \"aa\" 可以执行重复项删除操作，所以最后的字符串为 \"ca\"。","","","提示：","* 1 \u003c= S.length \u003c= 20000","* S 仅由小写英文字母组成。","","## 算法公开课","","**[《代码随想录》算法视频公开课](https://programmercarl.com/other/gongkaike.html)：[栈的好戏还要继续！| LeetCode：1047. 删除字符串中的所有相邻重复项](https://www.bilibili.com/video/BV12a411P7mw)，相信结合视频再看本篇题解，更有助于大家对本题的理解**。","","## 思路","","### 正题","","本题要删除相邻相同元素，相对于[20. 有效的括号](https://programmercarl.com/0020.%E6%9C%89%E6%95%88%E7%9A%84%E6%8B%AC%E5%8F%B7.html)来说其实也是匹配问题，20. 有效的括号 是匹配左右括号，本题是匹配相邻元素，最后都是做消除的操作。 ","","本题也是用栈来解决的经典题目。","","那么栈里应该放的是什么元素呢？ ","","我们在删除相邻重复项的时候，其实就是要知道当前遍历的这个元素，我们在前一位是不是遍历过一样数值的元素，那么如何记录前面遍历过的元素呢？ ","","所以就是用栈来存放，那么栈的目的，就是存放遍历过的元素，当遍历当前的这个元素的时候，去栈里看一下我们是不是遍历过相同数值的相邻元素。 ","","然后再去做对应的消除操作。 如动画所示：","","![1047.删除字符串中的所有相邻重复项](https://code-thinking.cdn.bcebos.com/gifs/1047.删除字符串中的所有相邻重复项.gif)","","从栈中弹出剩余元素，此时是字符串ac，因为从栈里弹出的元素是倒序的，所以再对字符串进行反转一下，就得到了最终的结果。","","C++代码 :","","```CPP","class Solution {","public:","    string removeDuplicates(string S) {","        stack\u003cchar\u003e st;","        for (char s : S) {","            if (st.empty() || s != st.top()) {","                st.push(s);","            } else {","                st.pop(); // s 与 st.top()相等的情况","            }","        }","        string result = \"\";","        while (!st.empty()) { // 将栈中元素放到result字符串汇总","            result += st.top();","            st.pop();","        }","        reverse (result.begin(), result.end()); // 此时字符串需要反转一下","        return result;","","    }","};","```","* 时间复杂度: O(n)","* 空间复杂度: O(n)","","","当然可以拿字符串直接作为栈，这样省去了栈还要转为字符串的操作。","","代码如下：","","```CPP","class Solution {","public:","    string removeDuplicates(string S) {","        string result;","        for(char s : S) {","            if(result.empty() || result.back() != s) {","                result.push_back(s);","            }","            else {","                result.pop_back();","            }","        }","        return result;","    }","};","```","* 时间复杂度: O(n)","* 空间复杂度: O(1)，返回值不计空间复杂度","","### 题外话","","这道题目就像是我们玩过的游戏对对碰，如果相同的元素挨在一起就要消除。","","可能我们在玩游戏的时候感觉理所当然应该消除，但程序又怎么知道该如何消除呢，特别是消除之后又有新的元素可能挨在一起。","","此时游戏的后端逻辑就可以用一个栈来实现（我没有实际考察对对碰或者爱消除游戏的代码实现，仅从原理上进行推断）。","","游戏开发可能使用栈结构，编程语言的一些功能实现也会使用栈结构，实现函数递归调用就需要栈，但不是每种编程语言都支持递归，例如：","","**递归的实现就是：每一次递归调用都会把函数的局部变量、参数值和返回地址等压入调用栈中**，然后递归返回的时候，从栈顶弹出上一次递归的各项参数，所以这就是递归为什么可以返回上一层位置的原因。","","相信大家应该遇到过一种错误就是栈溢出，系统输出的异常是`Segmentation fault`（当然不是所有的`Segmentation fault` 都是栈溢出导致的） ，如果你使用了递归，就要想一想是不是无限递归了，那么系统调用栈就会溢出。","","而且**在企业项目开发中，尽量不要使用递归**！在项目比较大的时候，由于参数多，全局变量等等，使用递归很容易判断不充分return的条件，非常容易无限递归（或者递归层级过深），**造成栈溢出错误（这种问题还不好排查！）**","","","","## 其他语言版本","","### Java：","","使用 Deque 作为堆栈","```Java","class Solution {","    public String removeDuplicates(String S) {","        //ArrayDeque会比LinkedList在除了删除元素这一点外会快一点","        //参考：https://stackoverflow.com/questions/6163166/why-is-arraydeque-better-than-linkedlist","        ArrayDeque\u003cCharacter\u003e deque = new ArrayDeque\u003c\u003e();","        char ch;","        for (int i = 0; i \u003c S.length(); i++) {","            ch = S.charAt(i);","            if (deque.isEmpty() || deque.peek() != ch) {","                deque.push(ch);","            } else {","                deque.pop();","            }","        }","        String str = \"\";","        //剩余的元素即为不重复的元素","        while (!deque.isEmpty()) {","            str = deque.pop() + str;","        }","        return str;","    }","}","```","拿字符串直接作为栈，省去了栈还要转为字符串的操作。","```Java","class Solution {","    public String removeDuplicates(String s) {","        // 将 res 当做栈","        // 也可以用 StringBuilder 来修改字符串，速度更快","        // StringBuilder res = new StringBuilder();","        StringBuffer res = new StringBuffer();","        // top为 res 的长度","        int top = -1;","        for (int i = 0; i \u003c s.length(); i++) {","            char c = s.charAt(i);","            // 当 top \u003e 0,即栈中有字符时，当前字符如果和栈中字符相等，弹出栈顶字符，同时 top--","            if (top \u003e= 0 \u0026\u0026 res.charAt(top) == c) {","                res.deleteCharAt(top);","                top--;","            // 否则，将该字符 入栈，同时top++","            } else {","                res.append(c);","                top++;","            }","        }","        return res.toString();","    }","}","```","","拓展：双指针","```java","class Solution {","    public String removeDuplicates(String s) {","        char[] ch = s.toCharArray();","        int fast = 0;","        int slow = 0;","        while(fast \u003c s.length()){","            // 直接用fast指针覆盖slow指针的值","            ch[slow] = ch[fast];","            // 遇到前后相同值的，就跳过，即slow指针后退一步，下次循环就可以直接被覆盖掉了","            if(slow \u003e 0 \u0026\u0026 ch[slow] == ch[slow - 1]){","                slow--;","            }else{","                slow++;","            }","            fast++;","        }","        return new String(ch,0,slow);","    }","}","```","","### Python：","","```python","# 方法一，使用栈","class Solution:","    def removeDuplicates(self, s: str) -\u003e str:","        res = list()","        for item in s:","            if res and res[-1] == item:","                res.pop()","            else:","                res.append(item)","        return \"\".join(res)  # 字符串拼接","```","","```python","# 方法二，使用双指针模拟栈，如果不让用栈可以作为备选方法。","class Solution:","    def removeDuplicates(self, s: str) -\u003e str:","        res = list(s)","        slow = fast = 0","        length = len(res)","","        while fast \u003c length:","            # 如果一样直接换，不一样会把后面的填在slow的位置","            res[slow] = res[fast]","            ","            # 如果发现和前一个一样，就退一格指针","            if slow \u003e 0 and res[slow] == res[slow - 1]:","                slow -= 1","            else:","                slow += 1","            fast += 1","            ","        return ''.join(res[0: slow])","```","","### Go：","","```go","func removeDuplicates(s string) string {","    var stack []byte","    for i := 0; i \u003c len(s);i++ {","        // 栈不空 且 与栈顶元素不等","        if len(stack) \u003e 0 \u0026\u0026 stack[len(stack)-1] == s[i] {","            // 弹出栈顶元素 并 忽略当前元素(s[i])","            stack = stack[:len(stack)-1]","        }else{","            // 入栈","            stack = append(stack, s[i])","        }","    }","    return string(stack)","}","```","","### JavaScript: ","","法一：使用栈","","```js","var removeDuplicates = function(s) {","    const result = []","    for(const i of s){","        if(i === result[result.length-1]){","            result.pop()","        }else{","            result.push(i)","        }","    }","    return result.join('')","};","```","","法二：双指针（模拟栈）","","```js","// 原地解法（双指针模拟栈）","var removeDuplicates = function(s) {","    s = [...s];","    let top = -1; // 指向栈顶元素的下标","    for(let i = 0; i \u003c s.length; i++) {","        if(top === -1 || s[top] !== s[i]) { // top === -1 即空栈","            s[++top] = s[i]; // 入栈","        } else {","            top--; // 推出栈","        }","    }","    s.length = top + 1; // 栈顶元素下标 + 1 为栈的长度","    return s.join('');","};","```","","### TypeScript：","","```typescript","function removeDuplicates(s: string): string {","    const helperStack: string[] = [];","    let i: number = 0;","    while (i \u003c s.length) {","        let top: string = helperStack[helperStack.length - 1];","        if (top === s[i]) {","            helperStack.pop();","        } else {","            helperStack.push(s[i]);","        }","        i++;","    }","    let res: string = '';","    while (helperStack.length \u003e 0) {","        res = helperStack.pop() + res;","    }","    return res;","};","```","","### C:","方法一：使用栈","","```c","char * removeDuplicates(char * s){","    //求出字符串长度","    int strLength = strlen(s);","    //开辟栈空间。栈空间长度应为字符串长度+1（为了存放字符串结束标志'\\0'）","    char* stack = (char*)malloc(sizeof(char) * strLength + 1);","    int stackTop = 0;","","    int index = 0;","    //遍历整个字符串","    while(index \u003c strLength) {","        //取出当前index对应字母，之后index+1","        char letter = s[index++];","        //若栈中有元素，且栈顶字母等于当前字母（两字母相邻）。将栈顶元素弹出","        if(stackTop \u003e 0 \u0026\u0026 letter == stack[stackTop - 1])","            stackTop--;","        //否则将字母入栈","        else","            stack[stackTop++] = letter;","    }","    //存放字符串结束标志'\\0'","    stack[stackTop] = '\\0';","    //返回栈本身作为字符串","    return stack;","}","```","方法二：双指针法","```c","char * removeDuplicates(char * s){","    //创建快慢指针","    int fast = 0;","    int slow = 0;","    //求出字符串长度","    int strLength = strlen(s);","    //遍历字符串","    while(fast \u003c strLength) {","        //将当前slow指向字符改为fast指向字符。fast指针+1","        char letter = s[slow] = s[fast++];","        //若慢指针大于0，且慢指针指向元素等于字符串中前一位元素，删除慢指针指向当前元素","        if(slow \u003e 0 \u0026\u0026 letter == s[slow - 1])","            slow--;","        else","            slow++;","    }","    //在字符串结束加入字符串结束标志'\\0'","    s[slow] = 0;","    return s;","}","```","","### Swift：","","```swift","func removeDuplicates(_ s: String) -\u003e String {","    var stack = [Character]()","    for c in s {","        if stack.last == c {","            stack.removeLast()","        } else {","            stack.append(c)","        }","    }","    return String(stack)","}","```","","### C#:","","```csharp","public string RemoveDuplicates(string s) {","        //拿字符串直接作为栈，省去了栈还要转为字符串的操作","        StringBuilder res = new StringBuilder();","","        foreach(char c in s){","            if(res.Length \u003e 0 \u0026\u0026 res[res.Length-1] == c){","                res.Remove(res.Length-1, 1);","            }else{","                res.Append(c);","            }","        }","       ","        return res.ToString();","    }","```","","### PHP:","","```php","class Solution {","    function removeDuplicates($s) {","        $stack = new SplStack();","        for($i=0;$i\u003cstrlen($s);$i++){","            if($stack-\u003eisEmpty() || $s[$i] != $stack-\u003etop()){","                $stack-\u003epush($s[$i]);","            }else{","               $stack-\u003epop(); ","            }","        }","","        $result = \"\";","        while(!$stack-\u003eisEmpty()){","            $result.= $stack-\u003etop();","            $stack-\u003epop();","        }","        ","        // 此时字符串需要反转一下","        return strrev($result);","    }","}","```","","### Scala:","","```scala","object Solution {","  import scala.collection.mutable","  def removeDuplicates(s: String): String = {","    var stack = mutable.Stack[Int]()","    var str = \"\" // 保存最终结果","    for (i \u003c- s.indices) {","      var tmp = s(i)","      // 如果栈非空并且栈顶元素等于当前字符，那么删掉栈顶和字符串最后一个元素","      if (!stack.isEmpty \u0026\u0026 tmp == stack.head) {","        str = str.take(str.length - 1)","        stack.pop()","      } else {","        stack.push(tmp)","        str += tmp","      }","    }","    str","  }","}","```","","### Rust:","","```rust","impl Solution {","    pub fn remove_duplicates(s: String) -\u003e String {","        let mut stack = vec![];","        let mut chars: Vec\u003cchar\u003e = s.chars().collect();","        while let Some(c) = chars.pop() {","            if stack.is_empty() || stack[stack.len() - 1] != c {","                stack.push(c);","            } else {","                stack.pop();","            }","        }","        stack.into_iter().rev().collect()","    }","}","```","","### Ruby","","```ruby","def remove_duplicates(s)","  #数组模拟栈","  stack = []","  s.each_char do |chr|","    if stack.empty?","      stack.push chr","    else","      head = stack.pop ","      #重新进栈","      stack.push head, chr if head != chr","    end","  end","","  return stack.join","end","```","","","\u003cp align=\"center\"\u003e","\u003ca href=\"https://programmercarl.com/other/kstar.html\" target=\"_blank\"\u003e","  \u003cimg src=\"../pics/网站星球宣传海报.jpg\" width=\"1000\"/\u003e","\u003c/a\u003e"],"stylingDirectives":[[[1,2,"pl-ent"],[3,8,"pl-e"],[9,10,"pl-s"],[10,16,"pl-s"],[16,17,"pl-s"]],[[1,2,"pl-ent"],[3,7,"pl-e"],[8,9,"pl-s"],[9,64,"pl-s"],[64,65,"pl-s"],[66,72,"pl-e"],[73,74,"pl-s"],[74,80,"pl-s"],[80,81,"pl-s"]],[[3,6,"pl-ent"],[7,10,"pl-e"],[11,12,"pl-s"],[12,27,"pl-s"],[27,28,"pl-s"],[29,34,"pl-e"],[35,36,"pl-s"],[36,40,"pl-s"],[40,41,"pl-s"]],[[2,3,"pl-ent"]],[[1,2,"pl-ent"],[3,8,"pl-e"],[9,10,"pl-s"],[10,16,"pl-s"],[16,17,"pl-s"],[19,25,"pl-ent"],[27,28,"pl-ent"],[29,33,"pl-e"],[34,35,"pl-s"],[35,49,"pl-s"],[49,50,"pl-s"],[58,59,"pl-ent"],[95,101,"pl-ent"],[104,105,"pl-ent"]],[],[],[[0,12,"pl-ent"],[0,2,"pl-ent"]],[[0,0,"pl-ent"]],[[0,22,"pl-mh"],[2,22,"pl-en"]],[],[[0,1,"pl-s"],[7,8,"pl-s"],[8,9,"pl-s"],[9,79,"pl-corl"],[79,80,"pl-s"]],[],[],[],[],[],[],[],[],[],[[0,1,"pl-v"]],[[0,1,"pl-v"]],[[0,1,"pl-v"]],[],[],[],[[0,1,"pl-v"]],[[0,1,"pl-v"]],[],[[0,8,"pl-mh"],[3,8,"pl-en"]],[],[[0,2,"pl-s"],[2,3,"pl-s"],[17,18,"pl-s"],[18,19,"pl-s"],[19,66,"pl-corl"],[66,67,"pl-s"],[68,69,"pl-s"],[109,110,"pl-s"],[110,111,"pl-s"],[111,154,"pl-corl"],[154,155,"pl-s"],[181,183,"pl-s"]],[],[[0,5,"pl-mh"],[3,5,"pl-en"]],[],[[0,6,"pl-mh"],[4,6,"pl-en"]],[],[[15,16,"pl-s"],[25,26,"pl-s"],[26,27,"pl-s"],[27,109,"pl-corl"],[109,110,"pl-s"]],[],[],[],[],[],[],[],[],[],[],[],[[0,2,"pl-s"],[21,22,"pl-s"],[22,23,"pl-s"],[23,88,"pl-corl"],[88,89,"pl-s"]],[],[],[],[],[],[[0,3,"pl-s"],[3,6,"pl-en"]],[[0,5,"pl-k"],[6,14,"pl-en"]],[],[],[[14,18,"pl-ent"]],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[[4,5,"pl-c1"]],[],[[0,3,"pl-s"]],[[0,1,"pl-v"]],[[0,1,"pl-v"]],[],[],[],[],[],[],[[0,3,"pl-s"],[3,6,"pl-en"]],[[0,5,"pl-k"],[6,14,"pl-en"]],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[[0,3,"pl-s"],[3,3,"pl-c1"]],[[0,13,"pl-c1"]],[[0,24,"pl-c1"]],[[0,0,"pl-c1"]],[[0,7,"pl-c1"]],[[0,0,"pl-c1"]],[[0,34,"pl-c1"]],[[0,0,"pl-c1"]],[[0,57,"pl-c1"]],[[0,0,"pl-c1"]],[[0,54,"pl-c1"]],[[0,0,"pl-c1"]],[[0,62,"pl-c1"]],[[0,0,"pl-c1"]],[[0,95,"pl-c1"]],[[0,0,"pl-c1"]],[[0,122,"pl-c1"]],[[0,0,"pl-c1"]],[[0,111,"pl-c1"]],[[0,0,"pl-c1"]],[[0,0,"pl-c1"]],[[0,0,"pl-c1"]],[[0,9,"pl-c1"]],[[0,0,"pl-c1"]],[[0,9,"pl-c1"]],[[0,0,"pl-c1"]],[[0,13,"pl-c1"]],[[0,7,"pl-c1"]],[[0,16,"pl-c1"]],[[0,46,"pl-c1"]],[[0,47,"pl-c1"]],[[0,97,"pl-c1"]],[[0,57,"pl-c1"]],[[0,16,"pl-c1"]],[[0,46,"pl-c1"]],[[0,29,"pl-c1"]],[[0,56,"pl-c1"]],[[0,31,"pl-c1"]],[[0,20,"pl-c1"]],[[0,28,"pl-c1"]],[[0,13,"pl-c1"]],[[0,9,"pl-c1"]],[[0,24,"pl-c1"]],[[0,23,"pl-c1"]],[[0,34,"pl-c1"]],[[0,36,"pl-c1"]],[[0,9,"pl-c1"]],[[0,19,"pl-c1"]],[[0,5,"pl-c1"]],[[0,1,"pl-c1"]],[[0,0,"pl-c1"],[0,3,"pl-s"]],[],[[0,3,"pl-s"],[3,7,"pl-en"]],[[0,5,"pl-k"],[6,14,"pl-en"]],[[4,10,"pl-k"],[11,17,"pl-smi"],[18,34,"pl-en"],[35,41,"pl-smi"],[42,43,"pl-v"]],[[8,20,"pl-c"],[8,10,"pl-c"]],[[8,41,"pl-c"],[8,10,"pl-c"]],[[8,51,"pl-c"],[8,10,"pl-c"]],[[8,20,"pl-smi"],[25,26,"pl-k"],[27,30,"pl-k"],[31,43,"pl-smi"]],[[8,23,"pl-c"],[8,10,"pl-c"]],[[8,11,"pl-k"],[16,17,"pl-k"],[18,19,"pl-k"],[19,20,"pl-c1"]],[[8,11,"pl-k"],[13,16,"pl-k"],[19,20,"pl-k"],[21,22,"pl-c1"],[26,27,"pl-k"],[29,30,"pl-k"],[41,43,"pl-k"]],[[12,16,"pl-k"],[19,20,"pl-k"],[22,23,"pl-k"]],[[12,62,"pl-c"],[12,14,"pl-c"]],[[12,14,"pl-k"],[20,22,"pl-k"],[23,24,"pl-c1"],[25,27,"pl-k"],[31,32,"pl-k"],[44,46,"pl-k"]],[[19,20,"pl-k"]],[[19,21,"pl-k"]],[[12,33,"pl-c"],[12,14,"pl-c"]],[[14,18,"pl-k"]],[[19,20,"pl-k"]],[[19,21,"pl-k"]],[],[],[[8,14,"pl-k"],[18,19,"pl-k"]],[],[],[[0,3,"pl-s"]],[],[],[[0,3,"pl-s"],[3,7,"pl-en"]],[[0,5,"pl-k"],[6,14,"pl-en"]],[[4,10,"pl-k"],[11,17,"pl-smi"],[18,34,"pl-en"],[35,41,"pl-smi"],[42,43,"pl-v"]],[[8,12,"pl-k"],[18,19,"pl-k"],[21,22,"pl-k"]],[[8,11,"pl-k"],[17,18,"pl-k"],[19,20,"pl-c1"]],[[8,11,"pl-k"],[17,18,"pl-k"],[19,20,"pl-c1"]],[[8,13,"pl-k"],[19,20,"pl-k"],[22,23,"pl-k"]],[[12,34,"pl-c"],[12,14,"pl-c"]],[[21,22,"pl-k"]],[[12,54,"pl-c"],[12,14,"pl-c"]],[[12,14,"pl-k"],[20,21,"pl-k"],[22,23,"pl-c1"],[24,26,"pl-k"],[36,38,"pl-k"],[47,48,"pl-k"],[49,50,"pl-c1"]],[[20,22,"pl-k"]],[[13,17,"pl-k"]],[[20,22,"pl-k"]],[],[[16,18,"pl-k"]],[],[[8,14,"pl-k"],[15,18,"pl-k"],[19,25,"pl-smi"],[29,30,"pl-c1"]],[],[],[[0,3,"pl-s"]],[],[[0,11,"pl-mh"],[4,11,"pl-en"]],[],[[0,3,"pl-s"],[3,9,"pl-en"]],[[0,9,"pl-c"],[0,1,"pl-c"]],[[0,5,"pl-k"],[6,14,"pl-en"]],[[4,7,"pl-k"],[8,24,"pl-en"],[25,29,"pl-smi"],[25,29,"pl-smi"],[31,32,"pl-smi"],[34,37,"pl-c1"],[42,45,"pl-c1"]],[[12,13,"pl-k"],[14,18,"pl-c1"]],[[8,11,"pl-k"],[17,19,"pl-k"]],[[12,14,"pl-k"],[19,22,"pl-k"],[27,28,"pl-k"],[28,29,"pl-c1"],[31,33,"pl-k"]],[],[[12,16,"pl-k"]],[],[[8,14,"pl-k"],[15,17,"pl-s"],[15,16,"pl-pds"],[16,17,"pl-pds"],[29,36,"pl-c"],[29,30,"pl-c"]],[[0,3,"pl-s"]],[],[[0,3,"pl-s"],[3,9,"pl-en"]],[[0,30,"pl-c"],[0,1,"pl-c"]],[[0,5,"pl-k"],[6,14,"pl-en"]],[[4,7,"pl-k"],[8,24,"pl-en"],[25,29,"pl-smi"],[25,29,"pl-smi"],[31,32,"pl-smi"],[34,37,"pl-c1"],[42,45,"pl-c1"]],[[12,13,"pl-k"],[14,18,"pl-c1"]],[[13,14,"pl-k"],[20,21,"pl-k"],[22,23,"pl-c1"]],[[15,16,"pl-k"],[17,20,"pl-c1"]],[],[[8,13,"pl-k"],[19,20,"pl-k"]],[[12,39,"pl-c"],[12,13,"pl-c"]],[[22,23,"pl-k"]],[],[[12,31,"pl-c"],[12,13,"pl-c"]],[[12,14,"pl-k"],[20,21,"pl-k"],[22,23,"pl-c1"],[24,27,"pl-k"],[38,40,"pl-k"],[50,51,"pl-k"],[52,53,"pl-c1"]],[[21,23,"pl-k"],[24,25,"pl-c1"]],[[12,16,"pl-k"]],[[21,23,"pl-k"],[24,25,"pl-c1"]],[[17,19,"pl-k"],[20,21,"pl-c1"]],[],[[8,14,"pl-k"],[15,17,"pl-s"],[15,16,"pl-pds"],[16,17,"pl-pds"],[27,28,"pl-c1"]],[[0,3,"pl-s"]],[],[[0,7,"pl-mh"],[4,7,"pl-en"]],[],[[0,3,"pl-s"],[3,5,"pl-en"]],[[0,4,"pl-k"],[5,21,"pl-en"],[22,23,"pl-v"],[24,30,"pl-v"],[32,38,"pl-v"]],[[4,7,"pl-k"],[8,13,"pl-smi"],[16,20,"pl-k"]],[[4,7,"pl-k"],[8,9,"pl-smi"],[10,12,"pl-k"],[13,14,"pl-c1"],[20,23,"pl-c1"]],[[8,24,"pl-c"],[8,10,"pl-c"]],[[8,10,"pl-k"],[11,14,"pl-c1"],[24,25,"pl-c1"],[35,38,"pl-c1"],[46,47,"pl-c1"]],[[12,36,"pl-c"],[12,14,"pl-c"]],[[27,30,"pl-c1"],[38,39,"pl-c1"]],[[9,13,"pl-k"]],[[12,17,"pl-c"],[12,14,"pl-c"]],[[20,26,"pl-c1"]],[],[],[[4,10,"pl-k"],[11,17,"pl-c1"]],[],[[0,3,"pl-s"]],[],[[0,16,"pl-mh"],[4,15,"pl-en"]],[],[],[],[[0,3,"pl-s"],[3,5,"pl-en"]],[[0,3,"pl-k"],[4,20,"pl-en"],[21,22,"pl-k"],[23,31,"pl-k"],[32,33,"pl-smi"]],[[4,9,"pl-k"],[10,16,"pl-c1"],[17,18,"pl-k"]],[[4,7,"pl-k"],[8,13,"pl-k"],[14,15,"pl-c1"],[16,18,"pl-k"]],[[8,10,"pl-k"],[13,16,"pl-k"],[24,30,"pl-smi"],[31,37,"pl-c1"],[37,38,"pl-k"],[38,39,"pl-c1"]],[[12,18,"pl-smi"],[19,22,"pl-c1"]],[[9,13,"pl-k"]],[[12,18,"pl-smi"],[19,23,"pl-c1"]],[],[],[[4,10,"pl-k"],[11,17,"pl-smi"],[18,22,"pl-c1"],[23,25,"pl-s"],[23,24,"pl-pds"],[24,25,"pl-pds"]],[],[[0,3,"pl-s"]],[],[],[],[[0,3,"pl-s"],[3,5,"pl-en"]],[[0,15,"pl-c"],[0,2,"pl-c"]],[[0,3,"pl-k"],[4,20,"pl-en"],[21,22,"pl-k"],[23,31,"pl-k"],[32,33,"pl-smi"]],[[6,7,"pl-k"],[9,12,"pl-k"]],[[4,7,"pl-k"],[12,13,"pl-k"],[14,15,"pl-k"],[15,16,"pl-c1"],[18,30,"pl-c"],[18,20,"pl-c"]],[[4,7,"pl-k"],[8,11,"pl-k"],[14,15,"pl-k"],[16,17,"pl-c1"],[21,22,"pl-k"],[23,24,"pl-smi"],[25,31,"pl-c1"],[34,36,"pl-k"]],[[8,10,"pl-k"],[15,18,"pl-k"],[19,20,"pl-k"],[20,21,"pl-c1"],[22,24,"pl-k"],[32,35,"pl-k"],[44,61,"pl-c"],[44,46,"pl-c"]],[[14,16,"pl-k"],[21,22,"pl-k"],[29,34,"pl-c"],[29,31,"pl-c"]],[[10,14,"pl-k"]],[[15,17,"pl-k"],[19,25,"pl-c"],[19,21,"pl-c"]],[],[],[[4,5,"pl-smi"],[6,12,"pl-c1"],[13,14,"pl-k"],[19,20,"pl-k"],[21,22,"pl-c1"],[24,43,"pl-c"],[24,26,"pl-c"]],[[4,10,"pl-k"],[11,12,"pl-smi"],[13,17,"pl-c1"],[18,20,"pl-s"],[18,19,"pl-pds"],[19,20,"pl-pds"]],[],[[0,3,"pl-s"]],[],[[0,15,"pl-mh"],[4,15,"pl-en"]],[],[[0,3,"pl-s"],[3,13,"pl-en"]],[[0,8,"pl-k"],[26,27,"pl-v"],[27,28,"pl-k"],[29,35,"pl-c1"],[36,37,"pl-k"],[38,44,"pl-c1"]],[[4,9,"pl-k"],[4,9,"pl-k"],[21,22,"pl-k"],[23,29,"pl-c1"],[32,33,"pl-k"]],[[4,7,"pl-k"],[9,10,"pl-k"],[11,17,"pl-c1"],[18,19,"pl-k"],[20,21,"pl-c1"]],[[4,9,"pl-k"],[11,12,"pl-smi"],[13,14,"pl-k"],[15,16,"pl-smi"],[17,23,"pl-c1"]],[[8,11,"pl-k"],[15,16,"pl-k"],[17,23,"pl-c1"],[24,25,"pl-k"],[26,37,"pl-smi"],[38,49,"pl-smi"],[50,56,"pl-c1"],[57,58,"pl-k"],[59,60,"pl-c1"]],[[8,10,"pl-k"],[12,15,"pl-smi"],[16,19,"pl-k"],[20,21,"pl-smi"],[22,23,"pl-smi"]],[[12,23,"pl-smi"],[24,27,"pl-c1"]],[[10,14,"pl-k"]],[[12,23,"pl-smi"],[24,28,"pl-c1"],[29,30,"pl-smi"],[31,32,"pl-smi"]],[],[[8,9,"pl-smi"],[9,11,"pl-k"]],[],[[4,7,"pl-k"],[11,12,"pl-k"],[13,19,"pl-c1"],[20,21,"pl-k"],[22,24,"pl-s"],[22,23,"pl-pds"],[23,24,"pl-pds"]],[[4,9,"pl-k"],[11,22,"pl-smi"],[23,29,"pl-c1"],[30,31,"pl-k"],[32,33,"pl-c1"]],[[8,11,"pl-smi"],[12,13,"pl-k"],[14,25,"pl-smi"],[26,29,"pl-c1"],[32,33,"pl-k"],[34,37,"pl-smi"]],[],[[4,10,"pl-k"],[11,14,"pl-smi"]],[],[[0,3,"pl-s"]],[],[[0,6,"pl-mh"],[4,6,"pl-en"]],[],[],[[0,3,"pl-s"],[3,4,"pl-en"]],[[0,4,"pl-k"],[7,23,"pl-en"]],[],[],[],[[8,9,"pl-s"],[23,24,"pl-s"]],[],[],[[4,18,"pl-c1"]],[[4,13,"pl-c1"]],[[4,30,"pl-c1"]],[[4,33,"pl-c1"]],[[4,33,"pl-c1"]],[[4,43,"pl-c1"]],[[4,57,"pl-c1"]],[[4,23,"pl-c1"]],[[4,17,"pl-c1"]],[[4,12,"pl-c1"]],[[4,39,"pl-c1"]],[[4,5,"pl-c1"]],[[4,19,"pl-c1"]],[[4,27,"pl-c1"]],[[4,16,"pl-c1"]],[[4,17,"pl-c1"]],[],[[0,3,"pl-s"],[3,3,"pl-c1"]],[[0,8,"pl-c1"]],[[0,4,"pl-c1"]],[[0,34,"pl-c1"]],[[0,12,"pl-c1"]],[[0,17,"pl-c1"]],[[0,17,"pl-c1"]],[[0,13,"pl-c1"]],[[0,30,"pl-c1"]],[[0,11,"pl-c1"]],[[0,29,"pl-c1"]],[[0,40,"pl-c1"]],[[0,42,"pl-c1"]],[[0,49,"pl-c1"]],[[0,45,"pl-c1"]],[[0,19,"pl-c1"]],[[0,12,"pl-c1"]],[[0,19,"pl-c1"]],[[0,5,"pl-c1"]],[[0,25,"pl-c1"]],[[0,16,"pl-c1"]],[[0,13,"pl-c1"]],[[0,1,"pl-c1"]],[[0,0,"pl-c1"],[0,3,"pl-s"]],[],[[0,10,"pl-mh"],[4,10,"pl-en"]],[],[[0,3,"pl-s"],[3,8,"pl-en"]],[[0,4,"pl-k"],[5,21,"pl-en"],[22,23,"pl-en"],[24,25,"pl-smi"],[27,33,"pl-c1"],[35,37,"pl-k"],[38,44,"pl-c1"]],[[4,7,"pl-k"],[14,15,"pl-k"],[17,26,"pl-c1"]],[[4,7,"pl-k"],[10,12,"pl-k"]],[[8,10,"pl-k"],[17,21,"pl-c1"],[22,24,"pl-k"]],[[18,28,"pl-c1"]],[[10,14,"pl-k"]],[[18,24,"pl-c1"]],[],[],[[4,10,"pl-k"],[11,17,"pl-c1"]],[],[[0,3,"pl-s"]],[],[[0,7,"pl-mh"],[4,7,"pl-en"]],[],[[0,3,"pl-s"],[3,9,"pl-en"]],[[0,6,"pl-k"],[7,13,"pl-k"],[14,30,"pl-en"],[31,37,"pl-k"],[38,39,"pl-smi"]],[[0,34,"pl-c"],[8,10,"pl-c"]],[[0,0,"pl-c"],[8,21,"pl-smi"],[22,25,"pl-smi"],[26,27,"pl-k"],[28,31,"pl-k"],[32,45,"pl-en"]],[],[[8,15,"pl-en"],[16,20,"pl-k"],[21,22,"pl-smi"],[23,25,"pl-k"],[26,27,"pl-smi"]],[[12,14,"pl-en"],[15,18,"pl-smi"],[19,25,"pl-smi"],[26,27,"pl-k"],[28,29,"pl-c1"],[30,32,"pl-k"],[33,36,"pl-smi"],[37,40,"pl-smi"],[41,47,"pl-smi"],[47,48,"pl-k"],[48,49,"pl-c1"],[51,53,"pl-k"],[54,55,"pl-smi"]],[[16,19,"pl-smi"],[20,26,"pl-en"],[27,30,"pl-smi"],[31,37,"pl-smi"],[37,38,"pl-k"],[38,39,"pl-c1"],[41,42,"pl-c1"]],[[13,17,"pl-smi"]],[[16,19,"pl-smi"],[20,26,"pl-en"],[27,28,"pl-smi"]],[],[],[],[[8,14,"pl-smi"],[15,18,"pl-smi"],[19,27,"pl-en"]],[],[[0,3,"pl-s"]],[],[[0,8,"pl-mh"],[4,8,"pl-en"]],[],[[0,3,"pl-s"],[3,6,"pl-en"]],[],[],[],[[20,26,"pl-ent"],[26,37,"pl-e"]],[[12,22,"pl-e"]],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[[0,3,"pl-s"]],[],[[0,10,"pl-mh"],[4,10,"pl-en"]],[],[[0,3,"pl-s"],[3,8,"pl-en"]],[[0,6,"pl-k"],[7,15,"pl-en"]],[[2,8,"pl-k"],[9,14,"pl-en"],[15,25,"pl-en"],[26,33,"pl-en"]],[[2,5,"pl-k"],[6,22,"pl-en"],[23,24,"pl-v"],[26,32,"pl-en"],[33,34,"pl-k"],[35,41,"pl-en"],[42,43,"pl-k"]],[[4,7,"pl-k"],[8,13,"pl-v"],[14,15,"pl-k"],[24,29,"pl-en"],[30,33,"pl-en"]],[[4,7,"pl-k"],[8,11,"pl-v"],[12,13,"pl-k"],[14,16,"pl-s"],[14,15,"pl-pds"],[15,16,"pl-pds"],[17,26,"pl-c"],[17,19,"pl-c"]],[[4,7,"pl-k"],[11,13,"pl-k"]],[[6,9,"pl-k"],[10,13,"pl-v"],[14,15,"pl-k"]],[[6,43,"pl-c"],[6,8,"pl-c"]],[[6,8,"pl-k"],[10,11,"pl-k"],[25,27,"pl-k"],[32,34,"pl-k"]],[[12,13,"pl-k"],[34,35,"pl-k"],[36,37,"pl-c1"]],[],[[8,12,"pl-k"]],[],[[12,14,"pl-k"]],[],[],[],[],[],[[0,3,"pl-s"]],[],[[0,9,"pl-mh"],[4,9,"pl-en"]],[],[[0,3,"pl-s"],[3,7,"pl-en"]],[[0,4,"pl-k"],[5,13,"pl-en"]],[[4,7,"pl-k"],[8,10,"pl-k"],[11,28,"pl-en"],[29,30,"pl-smi"],[30,31,"pl-k"],[32,38,"pl-en"],[40,42,"pl-k"],[43,49,"pl-en"]],[[8,11,"pl-k"],[12,15,"pl-k"],[16,21,"pl-smi"],[22,23,"pl-k"],[24,28,"pl-en"]],[[8,11,"pl-k"],[12,15,"pl-k"],[16,21,"pl-smi"],[21,22,"pl-k"],[23,26,"pl-en"],[27,31,"pl-k"],[33,34,"pl-k"],[35,36,"pl-smi"],[36,37,"pl-k"],[37,42,"pl-en"],[44,45,"pl-k"],[45,52,"pl-en"]],[[8,13,"pl-k"],[14,17,"pl-k"],[18,22,"pl-en"],[23,24,"pl-smi"],[26,27,"pl-k"],[28,33,"pl-smi"],[33,34,"pl-k"],[34,37,"pl-en"]],[[12,14,"pl-k"],[15,20,"pl-smi"],[20,21,"pl-k"],[21,29,"pl-en"],[32,34,"pl-k"],[35,40,"pl-smi"],[41,46,"pl-smi"],[46,47,"pl-k"],[47,50,"pl-en"],[53,54,"pl-k"],[55,56,"pl-c1"],[58,60,"pl-k"],[61,62,"pl-smi"]],[[16,21,"pl-smi"],[21,22,"pl-k"],[22,26,"pl-en"],[27,28,"pl-smi"]],[[14,18,"pl-k"]],[[16,21,"pl-smi"],[21,22,"pl-k"],[22,25,"pl-en"]],[],[],[[8,13,"pl-smi"],[13,14,"pl-k"],[14,23,"pl-en"],[25,26,"pl-k"],[26,29,"pl-en"],[31,32,"pl-k"],[32,39,"pl-en"]],[],[],[[0,3,"pl-s"]],[],[[0,8,"pl-mh"],[4,8,"pl-en"]],[],[[0,3,"pl-s"],[3,7,"pl-en"]],[[0,3,"pl-k"],[4,21,"pl-en"],[22,23,"pl-smi"]],[[2,8,"pl-c"],[2,3,"pl-c"]],[[8,9,"pl-k"]],[[14,16,"pl-k"],[18,21,"pl-smi"]],[[4,6,"pl-k"]],[],[[4,8,"pl-k"]],[[11,12,"pl-k"]],[[6,11,"pl-c"],[6,7,"pl-c"]],[[27,29,"pl-k"],[35,37,"pl-k"]],[[4,7,"pl-k"]],[[2,5,"pl-k"]],[],[[2,8,"pl-k"]],[[0,3,"pl-k"]],[[0,3,"pl-s"]],[],[],[[1,2,"pl-ent"],[3,8,"pl-e"],[9,10,"pl-s"],[10,16,"pl-s"],[16,17,"pl-s"]],[[1,2,"pl-ent"],[3,7,"pl-e"],[8,9,"pl-s"],[9,52,"pl-s"],[52,53,"pl-s"],[54,60,"pl-e"],[61,62,"pl-s"],[62,68,"pl-s"],[68,69,"pl-s"]],[[3,6,"pl-ent"],[7,10,"pl-e"],[11,12,"pl-s"],[12,32,"pl-s"],[32,33,"pl-s"],[34,39,"pl-e"],[40,41,"pl-s"],[41,45,"pl-s"],[45,46,"pl-s"]],[[2,3,"pl-ent"]]],"colorizedLines":null}},"title":"leetcode-master/problems/1047.删除字符串中的所有相邻重复项.md at master · feinan/leetcode-master","appPayload":{},"meta":{"title":"leetcode-master/problems/1047.删除字符串中的所有相邻重复项.md at master · feinan/leetcode-master"}}</script>
  <div data-target="react-app.reactRoot"><meta name="github-code-view-meta-stats" id="github-code-view-meta-stats" data-hydrostats="publish"/> <!-- --> <a hidden="" id="code-view-repo-link" href="/feinan/leetcode-master" data-discover="true"></a> <div class="d-none"></div><div><div style="--spacing:var(--spacing-none)" class="prc-PageLayout-PageLayoutRoot--KH-d" data-component="SplitPageLayout" data-has-sidebar="true"><div class="prc-PageLayout-SidebarWrapper-kLG4B CopilotSidePanelSidebar-module__SidePanel__L3O0C CopilotSidePanelSidebar-module__HiddenSidePanel__TBRGn" style="--spacing-column:var(--spacing-none)" data-is-hidden="false" data-position="end" data-sticky="true" data-responsive-variant="fullscreen"><div class="prc-PageLayout-VerticalDivider-9QRmK prc-PageLayout-SidebarVerticalDivider-0Rl0V" data-component="PageLayout.VerticalDivider" data-variant="line" data-position="end" style="--spacing:var(--spacing-none)"><div class="prc-PageLayout-DraggableHandle-9s6B4" data-component="PageLayout.DragHandle" role="slider" aria-label="Draggable pane splitter" aria-valuemin="450" aria-valuemax="768" aria-valuenow="544" aria-valuetext="Pane width 544 pixels" tabindex="0"></div></div><div class="prc-PageLayout-Sidebar-iciWg" data-component="SplitPageLayout.Sidebar" data-resizable="true" style="--spacing:var(--spacing-normal);--pane-min-width:450px;--pane-max-width:768px;--pane-width-custom:544px;--pane-width-size:var(--pane-width-custom);--pane-width:544px"><div class="height-full" data-testid="copilot-code-view-side-panel"><div id="copilot-side-panel-content" class="height-full"></div></div></div></div><div class="prc-PageLayout-PageLayoutWrapper-2BhU2" data-width="full"><div class="prc-PageLayout-PageLayoutContent-BneH9"><div id="repos-file-tree-sidebar" class="CodeViewFileTreeLayout-module__sidebar__n_Aau" tabindex="0"><div class="prc-PageLayout-PaneWrapper-pHPop ReposFileTreePane-module__Pane__rBZpI ReposFileTreePane-module__HideTree__AYZnm ReposFileTreePane-module__HidePane__VHAVt" style="--offset-header:0px;--spacing-row:var(--spacing-none);--spacing-column:var(--spacing-none)" data-is-hidden="false" data-position="start" data-sticky="true"><div class="prc-PageLayout-HorizontalDivider-JLVqp prc-PageLayout-PaneHorizontalDivider-9tbnE" data-component="PageLayout.HorizontalDivider" data-variant-regular="none" data-variant-narrow="none" data-position="start" style="--spacing-divider:var(--spacing-none);--spacing:var(--spacing-none)"></div><div class="prc-PageLayout-Pane-AyzHK" data-component="SplitPageLayout.Pane" data-resizable="true" style="--spacing:var(--spacing-none);--pane-min-width:256px;--pane-max-width:calc(100vw - var(--pane-max-width-diff));--pane-width-size:var(--pane-width-large);--pane-width:320px"></div><div class="prc-PageLayout-VerticalDivider-9QRmK prc-PageLayout-PaneVerticalDivider-le57g" data-component="PageLayout.VerticalDivider" data-variant-narrow="none" data-variant-regular="line" data-variant-wide="line" data-position="start" style="--spacing:var(--spacing-none)"><div class="prc-PageLayout-DraggableHandle-9s6B4" data-component="PageLayout.DragHandle" role="slider" aria-label="Draggable pane splitter" aria-valuemin="256" aria-valuemax="600" aria-valuenow="320" aria-valuetext="Pane width 320 pixels" tabindex="0"></div></div></div></div><div data-component="SplitPageLayout.Content" class="prc-PageLayout-ContentWrapper-gR9eG"><div class="prc-PageLayout-Content-xWL-A" data-width="full" style="--spacing:var(--spacing-none)"><div class="SharedPageLayout-module__content__IwGAp" data-selector="repos-split-pane-content" id="repos-split-pane-content" tabindex="0"> <!-- --> <div class="container CodeViewHeader-module__Box__JkPOb"><div class="CodeViewHeader-module__StickyHeader__Qn7UN" id="StickyHeader"><div class="CodeViewHeader-module__Box_1__SbNDV"><div class="CodeViewHeader-module__Box_2__TB46f"><div class="react-code-view-header-wrap--narrow CodeViewHeader-module__Box_3__q1zUL"><div class="CodeViewHeader-module__treeToggleWrapper__RQ__9"><h2 class="use-tree-pane-module__Heading__s4QbZ prc-Heading-Heading-MtWFE" data-component="Heading"><button data-component="Button" type="button" aria-label="Expand file tree" data-testid="expand-file-tree-button-mobile" class="prc-Button-ButtonBase-9n-Xk ExpandFileTreeButton-module__Button_1__Svs95" data-loading="false" data-size="medium" data-variant="invisible"><span data-component="buttonContent" data-align="center" class="prc-Button-ButtonContent-Iohp5"><span data-component="leadingVisual" class="prc-Button-Visual-YNt2F prc-Button-LeadingVisual-UySKu prc-Button-VisualWrap-E4cnq"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-arrow-left" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M7.78 12.53a.75.75 0 0 1-1.06 0L2.47 8.28a.75.75 0 0 1 0-1.06l4.25-4.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042L4.81 7h7.44a.75.75 0 0 1 0 1.5H4.81l2.97 2.97a.75.75 0 0 1 0 1.06Z"></path></svg></span><span data-component="text" class="prc-Button-Label-FWkx3">Files</span></span></button><button data-component="IconButton" type="button" data-testid="expand-file-tree-button" aria-controls="repos-file-tree" class="prc-Button-ButtonBase-9n-Xk position-relative ExpandFileTreeButton-module__expandButton__hDOcv ExpandFileTreeButton-module__filesButtonBreakpoint__zEvz3 fgColor-muted prc-Button-IconButton-fyge7" data-loading="false" data-no-visuals="true" data-size="medium" data-variant="invisible" aria-labelledby="_R_4lla9lik5_"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-sidebar-collapse" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M6.823 7.823a.25.25 0 0 1 0 .354l-2.396 2.396A.25.25 0 0 1 4 10.396V5.604a.25.25 0 0 1 .427-.177Z"></path><path d="M1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0ZM1.5 1.75v12.5c0 .138.112.25.25.25H9.5v-13H1.75a.25.25 0 0 0-.25.25ZM11 14.5h3.25a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25H11Z"></path></svg></button><span class="prc-TooltipV2-Tooltip-tLeuB" data-direction="se" data-component="Tooltip" aria-hidden="true" id="_R_4lla9lik5_">Expand file tree</span><div class="d-none"></div></h2></div><div class="react-code-view-header-mb--narrow mr-2"><button data-component="Button" type="button" aria-haspopup="true" aria-expanded="false" tabindex="0" aria-label="master branch" data-testid="anchor-button" data-icv-name="Switch branches/tags" class="prc-Button-ButtonBase-9n-Xk ref-selector-class RefSelectorAnchoredOverlay-module__RefSelectorOverlayBtn__a3WK3" data-loading="false" data-size="medium" data-variant="default" id="ref-picker-repos-header-ref-selector-wide"><span data-component="buttonContent" data-align="center" class="prc-Button-ButtonContent-Iohp5"><span data-component="leadingVisual" class="prc-Button-Visual-YNt2F prc-Button-LeadingVisual-UySKu prc-Button-VisualWrap-E4cnq"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-git-branch" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M9.5 3.25a2.25 2.25 0 1 1 3 2.122V6A2.5 2.5 0 0 1 10 8.5H6a1 1 0 0 0-1 1v1.128a2.251 2.251 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.5 0v1.836A2.493 2.493 0 0 1 6 7h4a1 1 0 0 0 1-1v-.628A2.25 2.25 0 0 1 9.5 3.25Zm-6 0a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Zm8.25-.75a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"></path></svg></span><span data-component="text" class="prc-Button-Label-FWkx3"><div class="RefSelectorAnchoredOverlay-module__RefSelectorOverlayContainer__yaf4p"><div style="max-width:125px" class="ref-selector-button-text-container RefSelectorAnchoredOverlay-module__RefSelectorBtnTextContainer__Di3rk"><span class="RefSelectorAnchoredOverlay-module__RefSelectorText__w_fmP">master</span></div></div></span><span data-component="trailingVisual" class="prc-Button-Visual-YNt2F prc-Button-VisualWrap-E4cnq"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-triangle-down" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="m4.427 7.427 3.396 3.396a.25.25 0 0 0 .354 0l3.396-3.396A.25.25 0 0 0 11.396 7H4.604a.25.25 0 0 0-.177.427Z"></path></svg></span></span></button><div class="d-none"></div></div><div class="react-code-view-header-mb--narrow CodeViewHeader-module__Box_5__MQ0hL"><div class="Breadcrumb-module__container__Vxvev Breadcrumb-module__lg__Rjz0A"><nav data-testid="breadcrumbs" aria-labelledby="repos-header-breadcrumb-heading" id="repos-header-breadcrumb" class="Breadcrumb-module__nav__rQFDj"><h2 class="sr-only ScreenReaderHeading-module__userSelectNone__rwWIk prc-Heading-Heading-MtWFE" data-component="Heading" data-testid="screen-reader-heading" id="repos-header-breadcrumb-heading">Breadcrumbs</h2><ol class="Breadcrumb-module__list__ZH6zr"><li class="Breadcrumb-module__listItem__Ib0x_"><a class="Breadcrumb-module__repoLink__O2Nbs prc-Link-Link-9ZwDx" data-component="Link" data-testid="breadcrumbs-repo-link" href="/feinan/leetcode-master/tree/master" data-discover="true">leetcode-master</a></li><li class="Breadcrumb-module__listItem__Ib0x_"><span class="Breadcrumb-module__separator__eNwsI Breadcrumb-module__lg__Rjz0A" aria-hidden="true">/</span><a class="Breadcrumb-module__directoryLink__kQy_t prc-Link-Link-9ZwDx" data-component="Link" href="/feinan/leetcode-master/tree/master/problems" data-discover="true">problems</a></li></ol></nav><div data-testid="breadcrumbs-filename" class="Breadcrumb-module__filename__equZR"><span class="Breadcrumb-module__separator__eNwsI Breadcrumb-module__lg__Rjz0A" aria-hidden="true">/</span><h1 class="Breadcrumb-module__filenameHeading__MNMtw Breadcrumb-module__lg__Rjz0A prc-Heading-Heading-MtWFE" data-component="Heading" tabindex="-1" id="file-name-id">1047.删除字符串中的所有相邻重复项.md</h1></div><button data-component="IconButton" type="button" class="prc-Button-ButtonBase-9n-Xk ml-2 prc-Button-IconButton-fyge7" data-loading="false" data-no-visuals="true" data-size="small" data-variant="invisible" aria-labelledby="_R_7lla9lik5_"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-copy" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path></svg></button><span class="CopyToClipboardIconButton-module__tooltip__WyiwL prc-TooltipV2-Tooltip-tLeuB" data-direction="nw" data-component="Tooltip" aria-label="Copy path" aria-hidden="true" id="_R_7lla9lik5_">Copy path</span></div></div></div><div class="react-code-view-header-element--wide"><div class="CodeViewHeader-module__Box_7___0R6c"><div class="d-flex gap-2"><div><div class="CodeViewHeader-module__FileResultsList__JDzUy"><span class="d-flex FileResultsList-module__FilesSearchBox__ivVkc TextInput-wrapper prc-components-TextInputWrapper-Hpdqi prc-components-TextInputBaseWrapper-wY-n0" data-no-trailing-action="true" data-component="TextInput" data-leading-visual="true" data-trailing-visual="true" aria-busy="false"><span class="TextInput-icon" id="_R_5ipla9lik5_" aria-hidden="true" data-component="TextInput.LeadingVisual"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-search" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg></span><input type="text" aria-label="Go to file" role="combobox" aria-controls="file-results-list" aria-expanded="false" aria-haspopup="dialog" autoCorrect="off" spellCheck="false" placeholder="Go to file" aria-describedby="_R_5ipla9lik5_ _R_5ipla9lik5H1_" data-component="input" class="prc-components-Input-IwWrt" value=""/><span class="TextInput-icon" id="_R_5ipla9lik5H1_" aria-hidden="true" data-component="TextInput.TrailingVisual"></span></span></div><div class="d-none"></div></div><button data-component="Button" type="button" style="display:none" class="prc-Button-ButtonBase-9n-Xk NavigationMenu-module__Button__LpKgm" data-loading="false" data-no-visuals="true" data-size="medium" data-variant="default"><span data-component="buttonContent" data-align="center" class="prc-Button-ButtonContent-Iohp5"><span data-component="text" class="prc-Button-Label-FWkx3">Blame</span></span></button><div class="d-none"></div><button data-component="IconButton" type="button" data-testid="more-file-actions-button-nav-menu-wide" aria-haspopup="true" aria-expanded="false" tabindex="0" class="prc-Button-ButtonBase-9n-Xk js-blob-dropdown-click NavigationMenu-module__IconButton__HpX3G prc-Button-IconButton-fyge7" data-loading="false" data-no-visuals="true" data-size="medium" data-variant="default" aria-labelledby="_R_v4pla9lik5_" id="_R_14pla9lik5_"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-kebab-horizontal" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M8 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3ZM1.5 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm13 0a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path></svg></button><span class="prc-TooltipV2-Tooltip-tLeuB" data-direction="nw" data-component="Tooltip" aria-hidden="true" id="_R_v4pla9lik5_">More file actions</span></div></div></div><div class="react-code-view-header-element--narrow"><div class="CodeViewHeader-module__Box_7___0R6c"><div class="d-flex gap-2"><button data-component="Button" type="button" style="display:none" class="prc-Button-ButtonBase-9n-Xk NavigationMenu-module__Button__LpKgm" data-loading="false" data-no-visuals="true" data-size="medium" data-variant="default"><span data-component="buttonContent" data-align="center" class="prc-Button-ButtonContent-Iohp5"><span data-component="text" class="prc-Button-Label-FWkx3">Blame</span></span></button><div class="d-none"></div><button data-component="IconButton" type="button" data-testid="more-file-actions-button-nav-menu-narrow" aria-haspopup="true" aria-expanded="false" tabindex="0" class="prc-Button-ButtonBase-9n-Xk js-blob-dropdown-click NavigationMenu-module__IconButton__HpX3G prc-Button-IconButton-fyge7" data-loading="false" data-no-visuals="true" data-size="medium" data-variant="default" aria-labelledby="_R_v4tla9lik5_" id="_R_14tla9lik5_"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-kebab-horizontal" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M8 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3ZM1.5 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm13 0a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path></svg></button><span class="prc-TooltipV2-Tooltip-tLeuB" data-direction="nw" data-component="Tooltip" aria-hidden="true" id="_R_v4tla9lik5_">More file actions</span></div></div></div></div></div></div></div><div class="CodeView-module__contentWrapper__cG2JH"><div class="react-code-view-bottom-padding"><div class="BlobTopBanners-module__Box__v_nvx"></div></div> <div class="d-none"></div><div class="d-flex flex-column border rounded-2 tmp-mb-3 pl-1"><div class="LatestCommit-module__Box__B25ZT"><h2 class="sr-only ScreenReaderHeading-module__userSelectNone__rwWIk prc-Heading-Heading-MtWFE" data-component="Heading" data-testid="screen-reader-heading">Latest commit</h2><div style="width:120px" class="Skeleton Skeleton--text" data-testid="loading"> </div><div class="d-flex flex-shrink-0 gap-2"><div data-testid="latest-commit-details" class="d-none d-sm-flex flex-items-center"></div><div class="d-flex gap-2"><h2 class="sr-only ScreenReaderHeading-module__userSelectNone__rwWIk prc-Heading-Heading-MtWFE" data-component="Heading" data-testid="screen-reader-heading">History</h2><a data-component="LinkButton" href="/feinan/leetcode-master/commits/master/problems/1047.%E5%88%A0%E9%99%A4%E5%AD%97%E7%AC%A6%E4%B8%B2%E4%B8%AD%E7%9A%84%E6%89%80%E6%9C%89%E7%9B%B8%E9%82%BB%E9%87%8D%E5%A4%8D%E9%A1%B9.md" class="prc-Button-ButtonBase-9n-Xk d-none d-lg-flex LinkButton-module__linkButton__nFnov flex-items-center fgColor-default" data-loading="false" data-size="small" data-variant="invisible"><span data-component="buttonContent" data-align="center" class="prc-Button-ButtonContent-Iohp5"><span data-component="leadingVisual" class="prc-Button-Visual-YNt2F prc-Button-LeadingVisual-UySKu prc-Button-VisualWrap-E4cnq"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-history" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="m.427 1.927 1.215 1.215a8.002 8.002 0 1 1-1.6 5.685.75.75 0 1 1 1.493-.154 6.5 6.5 0 1 0 1.18-4.458l1.358 1.358A.25.25 0 0 1 3.896 6H.25A.25.25 0 0 1 0 5.75V2.104a.25.25 0 0 1 .427-.177ZM7.75 4a.75.75 0 0 1 .75.75v2.992l2.028.812a.75.75 0 0 1-.557 1.392l-2.5-1A.751.751 0 0 1 7 8.25v-3.5A.75.75 0 0 1 7.75 4Z"></path></svg></span><span data-component="text" class="prc-Button-Label-FWkx3"><span class="fgColor-default">History</span></span></span></a><div class="d-sm-none"></div><div class="d-flex d-lg-none"><a data-component="LinkButton" aria-label="View commit history for this file." href="/feinan/leetcode-master/commits/master/problems/1047.%E5%88%A0%E9%99%A4%E5%AD%97%E7%AC%A6%E4%B8%B2%E4%B8%AD%E7%9A%84%E6%89%80%E6%9C%89%E7%9B%B8%E9%82%BB%E9%87%8D%E5%A4%8D%E9%A1%B9.md" class="prc-Button-ButtonBase-9n-Xk LinkButton-module__linkButton__nFnov flex-items-center fgColor-default" data-loading="false" data-size="small" data-variant="invisible" aria-describedby="_R_4mlala9lik5_"><span data-component="buttonContent" data-align="center" class="prc-Button-ButtonContent-Iohp5"><span data-component="leadingVisual" class="prc-Button-Visual-YNt2F prc-Button-LeadingVisual-UySKu prc-Button-VisualWrap-E4cnq"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-history" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="m.427 1.927 1.215 1.215a8.002 8.002 0 1 1-1.6 5.685.75.75 0 1 1 1.493-.154 6.5 6.5 0 1 0 1.18-4.458l1.358 1.358A.25.25 0 0 1 3.896 6H.25A.25.25 0 0 1 0 5.75V2.104a.25.25 0 0 1 .427-.177ZM7.75 4a.75.75 0 0 1 .75.75v2.992l2.028.812a.75.75 0 0 1-.557 1.392l-2.5-1A.751.751 0 0 1 7 8.25v-3.5A.75.75 0 0 1 7.75 4Z"></path></svg></span></span></a><span class="prc-TooltipV2-Tooltip-tLeuB" data-direction="s" data-component="Tooltip" role="tooltip" aria-hidden="true" id="_R_4mlala9lik5_">History</span></div></div></div></div></div><div class="d-flex flex-row"><div class="container BlobViewContent-module__blobContainer__DtH2d"><div class="react-code-size-details-banner BlobViewContent-module__codeSizeDetails__e5sUw"><div class="react-code-size-details-banner CodeSizeDetails-module__Box__VcD6l"><div class="text-mono CodeSizeDetails-module__Box_1__GVxQL"><div data-testid="blob-size" class="CodeSizeDetails-module__Truncate_1__lE93V prc-Truncate-Truncate-2G1eo" data-inline="true" title="14.5 KB" style="--truncate-max-width:100%"><span>502 lines (421 loc) · 14.5 KB</span></div></div></div></div><div class="react-blob-view-header-sticky BlobViewContent-module__stickyHeader__VwxB5" id="repos-sticky-header"><div class="BlobViewHeader-module__Box__yhm9u"><div class="react-blob-sticky-header"><div class="FileNameStickyHeader-module__outerWrapper__ZL4Xc FileNameStickyHeader-module__outerWrapperHidden__Zpynk"><div class="FileNameStickyHeader-module__Box_1__Hazu5"><div class="FileNameStickyHeader-module__Box_2__hoolP"><div class="FileNameStickyHeader-module__Box_3__MVKsk"><button data-component="Button" type="button" aria-haspopup="true" aria-expanded="false" tabindex="0" aria-label="master branch" data-testid="anchor-button" data-icv-name="Switch branches/tags" class="prc-Button-ButtonBase-9n-Xk ref-selector-class RefSelectorAnchoredOverlay-module__RefSelectorOverlayBtn__a3WK3" data-loading="false" data-size="medium" data-variant="default" id="ref-picker-repos-header-ref-selector"><span data-component="buttonContent" data-align="center" class="prc-Button-ButtonContent-Iohp5"><span data-component="leadingVisual" class="prc-Button-Visual-YNt2F prc-Button-LeadingVisual-UySKu prc-Button-VisualWrap-E4cnq"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-git-branch" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M9.5 3.25a2.25 2.25 0 1 1 3 2.122V6A2.5 2.5 0 0 1 10 8.5H6a1 1 0 0 0-1 1v1.128a2.251 2.251 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.5 0v1.836A2.493 2.493 0 0 1 6 7h4a1 1 0 0 0 1-1v-.628A2.25 2.25 0 0 1 9.5 3.25Zm-6 0a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Zm8.25-.75a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"></path></svg></span><span data-component="text" class="prc-Button-Label-FWkx3"><div class="RefSelectorAnchoredOverlay-module__RefSelectorOverlayContainer__yaf4p"><div style="max-width:125px" class="ref-selector-button-text-container RefSelectorAnchoredOverlay-module__RefSelectorBtnTextContainer__Di3rk"><span class="RefSelectorAnchoredOverlay-module__RefSelectorText__w_fmP">master</span></div></div></span><span data-component="trailingVisual" class="prc-Button-Visual-YNt2F prc-Button-VisualWrap-E4cnq"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-triangle-down" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="m4.427 7.427 3.396 3.396a.25.25 0 0 0 .354 0l3.396-3.396A.25.25 0 0 0 11.396 7H4.604a.25.25 0 0 0-.177.427Z"></path></svg></span></span></button><div class="d-none"></div></div><div class="FileNameStickyHeader-module__Box_4__FLhtt"><div class="Breadcrumb-module__container__Vxvev Breadcrumb-module__md__Wb1Gs"><nav data-testid="breadcrumbs" aria-labelledby="sticky-breadcrumb-heading" id="sticky-breadcrumb" class="Breadcrumb-module__nav__rQFDj"><h2 class="sr-only ScreenReaderHeading-module__userSelectNone__rwWIk prc-Heading-Heading-MtWFE" data-component="Heading" data-testid="screen-reader-heading" id="sticky-breadcrumb-heading">Breadcrumbs</h2><ol class="Breadcrumb-module__list__ZH6zr"><li class="Breadcrumb-module__listItem__Ib0x_"><a class="Breadcrumb-module__repoLink__O2Nbs prc-Link-Link-9ZwDx" data-component="Link" data-testid="breadcrumbs-repo-link" href="/feinan/leetcode-master/tree/master" data-discover="true">leetcode-master</a></li><li class="Breadcrumb-module__listItem__Ib0x_"><span class="Breadcrumb-module__separator__eNwsI Breadcrumb-module__md__Wb1Gs" aria-hidden="true">/</span><a class="Breadcrumb-module__directoryLink__kQy_t prc-Link-Link-9ZwDx" data-component="Link" href="/feinan/leetcode-master/tree/master/problems" data-discover="true">problems</a></li></ol></nav><div data-testid="breadcrumbs-filename" class="Breadcrumb-module__filename__equZR"><span class="Breadcrumb-module__separator__eNwsI Breadcrumb-module__md__Wb1Gs" aria-hidden="true">/</span><h1 class="Breadcrumb-module__filenameHeading__MNMtw Breadcrumb-module__md__Wb1Gs prc-Heading-Heading-MtWFE" data-component="Heading" tabindex="-1" id="sticky-file-name-id">1047.删除字符串中的所有相邻重复项.md</h1></div><button data-component="IconButton" type="button" class="prc-Button-ButtonBase-9n-Xk ml-2 prc-Button-IconButton-fyge7" data-loading="false" data-no-visuals="true" data-size="small" data-variant="invisible" aria-labelledby="_R_7lcpala9lik5_"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-copy" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path></svg></button><span class="CopyToClipboardIconButton-module__tooltip__WyiwL prc-TooltipV2-Tooltip-tLeuB" data-direction="s" data-component="Tooltip" aria-label="Copy path" aria-hidden="true" id="_R_7lcpala9lik5_">Copy path</span></div></div></div><button data-component="Button" type="button" class="prc-Button-ButtonBase-9n-Xk FileNameStickyHeader-module__Button__LSEU_ FileNameStickyHeader-module__GoToTopButton__nxAFn" data-loading="false" data-size="small" data-variant="invisible"><span data-component="buttonContent" data-align="center" class="prc-Button-ButtonContent-Iohp5"><span data-component="leadingVisual" class="prc-Button-Visual-YNt2F prc-Button-LeadingVisual-UySKu prc-Button-VisualWrap-E4cnq"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-arrow-up" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M3.47 7.78a.75.75 0 0 1 0-1.06l4.25-4.25a.75.75 0 0 1 1.06 0l4.25 4.25a.751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018L9 4.81v7.44a.75.75 0 0 1-1.5 0V4.81L4.53 7.78a.75.75 0 0 1-1.06 0Z"></path></svg></span><span data-component="text" class="prc-Button-Label-FWkx3">Top</span></span></button></div></div></div><div class="BlobViewHeader-module__Box_1__VEmuQ"><h2 class="sr-only ScreenReaderHeading-module__userSelectNone__rwWIk prc-Heading-Heading-MtWFE" data-component="Heading" data-testid="screen-reader-heading">File metadata and controls</h2><div class="BlobViewHeader-module__Box_2__icUs2"><ul aria-label="File view" class="prc-SegmentedControl-SegmentedControl-lqIXp BlobTabButtons-module__SegmentedControl__jen2u" data-variant="default" data-size="small" data-component="SegmentedControl"><li class="prc-SegmentedControl-Item-tSCQh" data-selected="" data-component="SegmentedControl.Button"><button aria-pressed="true" class="prc-SegmentedControl-Button-E48xz" type="button" style="--separator-color:transparent"><span class="prc-SegmentedControl-Content-1COlk segmentedControl-content"><div class="prc-SegmentedControl-Text-7S2y2 segmentedControl-text" data-text="Preview">Preview</div></span></button></li><li class="prc-SegmentedControl-Item-tSCQh" data-component="SegmentedControl.Button"><button aria-pressed="false" class="prc-SegmentedControl-Button-E48xz" type="button" style="--separator-color:var(--borderColor-default)"><span class="prc-SegmentedControl-Content-1COlk segmentedControl-content"><div class="prc-SegmentedControl-Text-7S2y2 segmentedControl-text" data-text="Code">Code</div></span></button></li><li class="prc-SegmentedControl-Item-tSCQh" data-component="SegmentedControl.Button"><button aria-pressed="false" class="prc-SegmentedControl-Button-E48xz" type="button" style="--separator-color:var(--borderColor-default)"><span class="prc-SegmentedControl-Content-1COlk segmentedControl-content"><div class="prc-SegmentedControl-Text-7S2y2 segmentedControl-text" data-text="Blame">Blame</div></span></button></li></ul><div class="d-none"></div><div class="react-code-size-details-in-header CodeSizeDetails-module__Box__VcD6l"><div class="text-mono CodeSizeDetails-module__Box_1__GVxQL"><div data-testid="blob-size" class="CodeSizeDetails-module__Truncate_1__lE93V prc-Truncate-Truncate-2G1eo" data-inline="true" title="14.5 KB" style="--truncate-max-width:100%"><span>502 lines (421 loc) · 14.5 KB</span></div></div></div></div><div class="BlobViewHeader-module__Box_3__ng6v2"><div class="d-none"></div><div class="react-blob-header-edit-and-raw-actions BlobViewHeader-module__Box_4__J4Y4W"><div class="d-none"></div><div class="prc-ButtonGroup-ButtonGroup-vFUrY" data-component="ButtonGroup"><div class="prc-ButtonGroup-Item-PqvDl"><a data-component="LinkButton" href="https://github.com/feinan/leetcode-master/raw/refs/heads/master/problems/1047.%E5%88%A0%E9%99%A4%E5%AD%97%E7%AC%A6%E4%B8%B2%E4%B8%AD%E7%9A%84%E6%89%80%E6%9C%89%E7%9B%B8%E9%82%BB%E9%87%8D%E5%A4%8D%E9%A1%B9.md" data-testid="raw-button" class="prc-Button-ButtonBase-9n-Xk LinkButton-module__linkButton__nFnov BlobViewHeader-module__LinkButton__X9kx2" data-loading="false" data-no-visuals="true" data-size="small" data-variant="default"><span data-component="buttonContent" data-align="center" class="prc-Button-ButtonContent-Iohp5"><span data-component="text" class="prc-Button-Label-FWkx3">Raw</span></span></a></div><div class="prc-ButtonGroup-Item-PqvDl"><button data-component="IconButton" type="button" data-testid="copy-raw-button" class="prc-Button-ButtonBase-9n-Xk prc-Button-IconButton-fyge7" data-loading="false" data-no-visuals="true" data-size="small" data-variant="default" aria-labelledby="_R_qaucpala9lik5_"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-copy" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path></svg></button><span class="prc-TooltipV2-Tooltip-tLeuB" data-direction="n" data-component="Tooltip" aria-hidden="true" id="_R_qaucpala9lik5_">Copy raw file</span></div><div class="prc-ButtonGroup-Item-PqvDl"><button data-component="IconButton" type="button" data-testid="download-raw-button" class="prc-Button-ButtonBase-9n-Xk BlobViewHeader-module__downloadButton__ef459 prc-Button-IconButton-fyge7" data-loading="false" data-no-visuals="true" data-size="small" data-variant="default" aria-labelledby="_R_eaucpala9lik5_"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-download" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M2.75 14A1.75 1.75 0 0 1 1 12.25v-2.5a.75.75 0 0 1 1.5 0v2.5c0 .138.112.25.25.25h10.5a.25.25 0 0 0 .25-.25v-2.5a.75.75 0 0 1 1.5 0v2.5A1.75 1.75 0 0 1 13.25 14Z"></path><path d="M7.25 7.689V2a.75.75 0 0 1 1.5 0v5.689l1.97-1.969a.749.749 0 1 1 1.06 1.06l-3.25 3.25a.749.749 0 0 1-1.06 0L4.22 6.78a.749.749 0 1 1 1.06-1.06l1.97 1.969Z"></path></svg></button><span class="prc-TooltipV2-Tooltip-tLeuB" data-direction="n" data-component="Tooltip" aria-hidden="true" id="_R_eaucpala9lik5_">Download raw file</span></div></div></div><button data-component="IconButton" type="button" aria-pressed="false" class="prc-Button-ButtonBase-9n-Xk tmp-mr-2 TableOfContents-module__IconButton__jrlNM prc-Button-IconButton-fyge7" data-loading="false" data-no-visuals="true" data-size="small" data-variant="invisible" aria-labelledby="_R_3ucpala9lik5_"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-list-unordered" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M5.75 2.5h8.5a.75.75 0 0 1 0 1.5h-8.5a.75.75 0 0 1 0-1.5Zm0 5h8.5a.75.75 0 0 1 0 1.5h-8.5a.75.75 0 0 1 0-1.5Zm0 5h8.5a.75.75 0 0 1 0 1.5h-8.5a.75.75 0 0 1 0-1.5ZM2 14a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm1-6a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM2 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path></svg></button><span class="prc-TooltipV2-Tooltip-tLeuB" data-direction="n" data-component="Tooltip" aria-hidden="true" id="_R_3ucpala9lik5_">Outline</span><div class="react-blob-header-edit-and-raw-actions-combined"><button data-component="IconButton" type="button" title="More file actions" data-testid="more-file-actions-button" aria-haspopup="true" aria-expanded="false" tabindex="0" class="prc-Button-ButtonBase-9n-Xk js-blob-dropdown-click BlobViewHeader-module__IconButton__XrMQY prc-Button-IconButton-fyge7" data-loading="false" data-no-visuals="true" data-size="small" data-variant="invisible" aria-labelledby="_R_fkecpala9lik5_" id="_R_kecpala9lik5_"><svg data-component="Octicon" aria-hidden="true" focusable="false" class="octicon octicon-kebab-horizontal" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M8 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3ZM1.5 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm13 0a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path></svg></button><span class="prc-TooltipV2-Tooltip-tLeuB" data-direction="nw" data-component="Tooltip" aria-hidden="true" id="_R_fkecpala9lik5_">Edit and raw actions</span></div></div></div></div><div></div></div><div class="BlobViewContent-module__blobContentWrapper__JS0W6"><section aria-labelledby="file-name-id-wide file-name-id-mobile" class="BlobContent-module__blobContentSection__VOgZq BlobContent-module__blobContentSectionMarkdown__mPLOK" style="margin-top:46px"><div class="js-snippet-clipboard-copy-unpositioned BlobContent-module__markdownBlob__T8jpG" data-hpc="true" containertiming="hpc"><article class="markdown-body entry-content container-lg" itemprop="text"><p align="center" dir="auto">
<a href="https://www.programmercarl.com/xunlian/xunlianying.html" rel="nofollow">
  <img src="/feinan/leetcode-master/raw/master/pics/训练营.png" width="1000" style="max-width: 100%;">
</a>
</p><p align="center" dir="auto"><strong><a href="/feinan/leetcode-master/blob/master/problems/qita/join.md">参与本项目</a>，贡献其他语言版本的代码，拥抱开源，让更多学习算法的小伙伴们受益！</strong></p>
<blockquote>
<p dir="auto">匹配问题都是栈的强项</p>
</blockquote>
<div class="markdown-heading" dir="auto"><h1 tabindex="-1" class="heading-element" dir="auto">1047. 删除字符串中的所有相邻重复项</h1><a id="user-content-1047-删除字符串中的所有相邻重复项" class="anchor" aria-label="Permalink: 1047. 删除字符串中的所有相邻重复项" href="#1047-删除字符串中的所有相邻重复项"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<p dir="auto"><a href="https://leetcode.cn/problems/remove-all-adjacent-duplicates-in-string/" rel="nofollow">力扣题目链接</a></p>
<p dir="auto">给出由小写字母组成的字符串 S，重复项删除操作会选择两个相邻且相同的字母，并删除它们。</p>
<p dir="auto">在 S 上反复执行重复项删除操作，直到无法继续删除。</p>
<p dir="auto">在完成所有重复项删除操作后返回最终的字符串。答案保证唯一。</p>
<p dir="auto">示例：</p>
<ul dir="auto">
<li>输入："abbaca"</li>
<li>输出："ca"</li>
<li>解释：例如，在 "abbaca" 中，我们可以删除 "bb" 由于两字母相邻且相同，这是此时唯一可以执行删除操作的重复项。之后我们得到字符串 "aaca"，其中又只有 "aa" 可以执行重复项删除操作，所以最后的字符串为 "ca"。</li>
</ul>
<p dir="auto">提示：</p>
<ul dir="auto">
<li>1 &lt;= S.length &lt;= 20000</li>
<li>S 仅由小写英文字母组成。</li>
</ul>
<div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">算法公开课</h2><a id="user-content-算法公开课" class="anchor" aria-label="Permalink: 算法公开课" href="#算法公开课"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<p dir="auto"><strong><a href="https://programmercarl.com/other/gongkaike.html" rel="nofollow">《代码随想录》算法视频公开课</a>：<a href="https://www.bilibili.com/video/BV12a411P7mw" rel="nofollow">栈的好戏还要继续！| LeetCode：1047. 删除字符串中的所有相邻重复项</a>，相信结合视频再看本篇题解，更有助于大家对本题的理解</strong>。</p>
<div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">思路</h2><a id="user-content-思路" class="anchor" aria-label="Permalink: 思路" href="#思路"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">正题</h3><a id="user-content-正题" class="anchor" aria-label="Permalink: 正题" href="#正题"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<p dir="auto">本题要删除相邻相同元素，相对于<a href="https://programmercarl.com/0020.%E6%9C%89%E6%95%88%E7%9A%84%E6%8B%AC%E5%8F%B7.html" rel="nofollow">20. 有效的括号</a>来说其实也是匹配问题，20. 有效的括号 是匹配左右括号，本题是匹配相邻元素，最后都是做消除的操作。</p>
<p dir="auto">本题也是用栈来解决的经典题目。</p>
<p dir="auto">那么栈里应该放的是什么元素呢？</p>
<p dir="auto">我们在删除相邻重复项的时候，其实就是要知道当前遍历的这个元素，我们在前一位是不是遍历过一样数值的元素，那么如何记录前面遍历过的元素呢？</p>
<p dir="auto">所以就是用栈来存放，那么栈的目的，就是存放遍历过的元素，当遍历当前的这个元素的时候，去栈里看一下我们是不是遍历过相同数值的相邻元素。</p>
<p dir="auto">然后再去做对应的消除操作。 如动画所示：</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/e4b06f9bdca5c75449697d96f169f270edc1ec762383a64827505f6a437cf823/68747470733a2f2f636f64652d7468696e6b696e672e63646e2e626365626f732e636f6d2f676966732f313034372e2545352538382541302545392539392541342545352541442539372545372541432541362545342542382542322545342542382541442545372539412538342545362538392538302545362539432538392545372539422542382545392538322542422545392538372538442545352541342538442545392541312542392e676966"><img src="https://camo.githubusercontent.com/e4b06f9bdca5c75449697d96f169f270edc1ec762383a64827505f6a437cf823/68747470733a2f2f636f64652d7468696e6b696e672e63646e2e626365626f732e636f6d2f676966732f313034372e2545352538382541302545392539392541342545352541442539372545372541432541362545342542382542322545342542382541442545372539412538342545362538392538302545362539432538392545372539422542382545392538322542422545392538372538442545352541342538442545392541312542392e676966" alt="1047.删除字符串中的所有相邻重复项" data-animated-image="" data-canonical-src="https://code-thinking.cdn.bcebos.com/gifs/1047.%E5%88%A0%E9%99%A4%E5%AD%97%E7%AC%A6%E4%B8%B2%E4%B8%AD%E7%9A%84%E6%89%80%E6%9C%89%E7%9B%B8%E9%82%BB%E9%87%8D%E5%A4%8D%E9%A1%B9.gif" style="max-width: 100%;"></a></p>
<p dir="auto">从栈中弹出剩余元素，此时是字符串ac，因为从栈里弹出的元素是倒序的，所以再对字符串进行反转一下，就得到了最终的结果。</p>
<p dir="auto">C++代码 :</p>
<div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="class Solution {
public:
    string removeDuplicates(string S) {
        stack&lt;char&gt; st;
        for (char s : S) {
            if (st.empty() || s != st.top()) {
                st.push(s);
            } else {
                st.pop(); // s 与 st.top()相等的情况
            }
        }
        string result = &quot;&quot;;
        while (!st.empty()) { // 将栈中元素放到result字符串汇总
            result += st.top();
            st.pop();
        }
        reverse (result.begin(), result.end()); // 此时字符串需要反转一下
        return result;

    }
};"><pre><span class="pl-k">class</span> <span class="pl-en">Solution</span> {
<span class="pl-k">public:</span>
    string <span class="pl-en">removeDuplicates</span>(string S) {
        stack&lt;<span class="pl-k">char</span>&gt; st;
        <span class="pl-k">for</span> (<span class="pl-k">char</span> s : S) {
            <span class="pl-k">if</span> (st.<span class="pl-c1">empty</span>() || s != st.<span class="pl-c1">top</span>()) {
                st.<span class="pl-c1">push</span>(s);
            } <span class="pl-k">else</span> {
                st.<span class="pl-c1">pop</span>(); <span class="pl-c"><span class="pl-c">//</span> s 与 st.top()相等的情况</span>
            }
        }
        string result = <span class="pl-s"><span class="pl-pds">"</span><span class="pl-pds">"</span></span>;
        <span class="pl-k">while</span> (!st.<span class="pl-c1">empty</span>()) { <span class="pl-c"><span class="pl-c">//</span> 将栈中元素放到result字符串汇总</span>
            result += st.<span class="pl-c1">top</span>();
            st.<span class="pl-c1">pop</span>();
        }
        <span class="pl-c1">reverse</span> (result.<span class="pl-c1">begin</span>(), result.<span class="pl-c1">end</span>()); <span class="pl-c"><span class="pl-c">//</span> 此时字符串需要反转一下</span>
        <span class="pl-k">return</span> result;

    }
};</pre></div>
<ul dir="auto">
<li>时间复杂度: O(n)</li>
<li>空间复杂度: O(n)</li>
</ul>
<p dir="auto">当然可以拿字符串直接作为栈，这样省去了栈还要转为字符串的操作。</p>
<p dir="auto">代码如下：</p>
<div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="class Solution {
public:
    string removeDuplicates(string S) {
        string result;
        for(char s : S) {
            if(result.empty() || result.back() != s) {
                result.push_back(s);
            }
            else {
                result.pop_back();
            }
        }
        return result;
    }
};"><pre><span class="pl-k">class</span> <span class="pl-en">Solution</span> {
<span class="pl-k">public:</span>
    string <span class="pl-en">removeDuplicates</span>(string S) {
        string result;
        <span class="pl-k">for</span>(<span class="pl-k">char</span> s : S) {
            <span class="pl-k">if</span>(result.<span class="pl-c1">empty</span>() || result.<span class="pl-c1">back</span>() != s) {
                result.<span class="pl-c1">push_back</span>(s);
            }
            <span class="pl-k">else</span> {
                result.<span class="pl-c1">pop_back</span>();
            }
        }
        <span class="pl-k">return</span> result;
    }
};</pre></div>
<ul dir="auto">
<li>时间复杂度: O(n)</li>
<li>空间复杂度: O(1)，返回值不计空间复杂度</li>
</ul>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">题外话</h3><a id="user-content-题外话" class="anchor" aria-label="Permalink: 题外话" href="#题外话"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<p dir="auto">这道题目就像是我们玩过的游戏对对碰，如果相同的元素挨在一起就要消除。</p>
<p dir="auto">可能我们在玩游戏的时候感觉理所当然应该消除，但程序又怎么知道该如何消除呢，特别是消除之后又有新的元素可能挨在一起。</p>
<p dir="auto">此时游戏的后端逻辑就可以用一个栈来实现（我没有实际考察对对碰或者爱消除游戏的代码实现，仅从原理上进行推断）。</p>
<p dir="auto">游戏开发可能使用栈结构，编程语言的一些功能实现也会使用栈结构，实现函数递归调用就需要栈，但不是每种编程语言都支持递归，例如：</p>
<p dir="auto"><strong>递归的实现就是：每一次递归调用都会把函数的局部变量、参数值和返回地址等压入调用栈中</strong>，然后递归返回的时候，从栈顶弹出上一次递归的各项参数，所以这就是递归为什么可以返回上一层位置的原因。</p>
<p dir="auto">相信大家应该遇到过一种错误就是栈溢出，系统输出的异常是<code>Segmentation fault</code>（当然不是所有的<code>Segmentation fault</code> 都是栈溢出导致的） ，如果你使用了递归，就要想一想是不是无限递归了，那么系统调用栈就会溢出。</p>
<p dir="auto">而且<strong>在企业项目开发中，尽量不要使用递归</strong>！在项目比较大的时候，由于参数多，全局变量等等，使用递归很容易判断不充分return的条件，非常容易无限递归（或者递归层级过深），<strong>造成栈溢出错误（这种问题还不好排查！）</strong></p>
<div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">其他语言版本</h2><a id="user-content-其他语言版本" class="anchor" aria-label="Permalink: 其他语言版本" href="#其他语言版本"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Java：</h3><a id="user-content-java" class="anchor" aria-label="Permalink: Java：" href="#java"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<p dir="auto">使用 Deque 作为堆栈</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="class Solution {
    public String removeDuplicates(String S) {
        //ArrayDeque会比LinkedList在除了删除元素这一点外会快一点
        //参考：https://stackoverflow.com/questions/6163166/why-is-arraydeque-better-than-linkedlist
        ArrayDeque&lt;Character&gt; deque = new ArrayDeque&lt;&gt;();
        char ch;
        for (int i = 0; i &lt; S.length(); i++) {
            ch = S.charAt(i);
            if (deque.isEmpty() || deque.peek() != ch) {
                deque.push(ch);
            } else {
                deque.pop();
            }
        }
        String str = &quot;&quot;;
        //剩余的元素即为不重复的元素
        while (!deque.isEmpty()) {
            str = deque.pop() + str;
        }
        return str;
    }
}"><pre><span class="pl-k">class</span> <span class="pl-smi">Solution</span> {
    <span class="pl-k">public</span> <span class="pl-smi">String</span> <span class="pl-en">removeDuplicates</span>(<span class="pl-smi">String</span> <span class="pl-s1">S</span>) {
        <span class="pl-c">//ArrayDeque会比LinkedList在除了删除元素这一点外会快一点</span>
        <span class="pl-c">//参考：https://stackoverflow.com/questions/6163166/why-is-arraydeque-better-than-linkedlist</span>
        <span class="pl-smi">ArrayDeque</span>&lt;<span class="pl-smi">Character</span>&gt; <span class="pl-s1">deque</span> = <span class="pl-k">new</span> <span class="pl-smi">ArrayDeque</span>&lt;&gt;();
        <span class="pl-smi">char</span> <span class="pl-s1">ch</span>;
        <span class="pl-k">for</span> (<span class="pl-smi">int</span> <span class="pl-s1">i</span> = <span class="pl-c1">0</span>; <span class="pl-s1">i</span> &lt; <span class="pl-smi">S</span>.<span class="pl-en">length</span>(); <span class="pl-s1">i</span>++) {
            <span class="pl-s1">ch</span> = <span class="pl-smi">S</span>.<span class="pl-en">charAt</span>(<span class="pl-s1">i</span>);
            <span class="pl-k">if</span> (<span class="pl-s1">deque</span>.<span class="pl-en">isEmpty</span>() || <span class="pl-s1">deque</span>.<span class="pl-en">peek</span>() != <span class="pl-s1">ch</span>) {
                <span class="pl-s1">deque</span>.<span class="pl-en">push</span>(<span class="pl-s1">ch</span>);
            } <span class="pl-k">else</span> {
                <span class="pl-s1">deque</span>.<span class="pl-en">pop</span>();
            }
        }
        <span class="pl-smi">String</span> <span class="pl-s1">str</span> = <span class="pl-s">""</span>;
        <span class="pl-c">//剩余的元素即为不重复的元素</span>
        <span class="pl-k">while</span> (!<span class="pl-s1">deque</span>.<span class="pl-en">isEmpty</span>()) {
            <span class="pl-s1">str</span> = <span class="pl-s1">deque</span>.<span class="pl-en">pop</span>() + <span class="pl-s1">str</span>;
        }
        <span class="pl-k">return</span> <span class="pl-s1">str</span>;
    }
}</pre></div>
<p dir="auto">拿字符串直接作为栈，省去了栈还要转为字符串的操作。</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="class Solution {
    public String removeDuplicates(String s) {
        // 将 res 当做栈
        // 也可以用 StringBuilder 来修改字符串，速度更快
        // StringBuilder res = new StringBuilder();
        StringBuffer res = new StringBuffer();
        // top为 res 的长度
        int top = -1;
        for (int i = 0; i &lt; s.length(); i++) {
            char c = s.charAt(i);
            // 当 top &gt; 0,即栈中有字符时，当前字符如果和栈中字符相等，弹出栈顶字符，同时 top--
            if (top &gt;= 0 &amp;&amp; res.charAt(top) == c) {
                res.deleteCharAt(top);
                top--;
            // 否则，将该字符 入栈，同时top++
            } else {
                res.append(c);
                top++;
            }
        }
        return res.toString();
    }
}"><pre><span class="pl-k">class</span> <span class="pl-smi">Solution</span> {
    <span class="pl-k">public</span> <span class="pl-smi">String</span> <span class="pl-en">removeDuplicates</span>(<span class="pl-smi">String</span> <span class="pl-s1">s</span>) {
        <span class="pl-c">// 将 res 当做栈</span>
        <span class="pl-c">// 也可以用 StringBuilder 来修改字符串，速度更快</span>
        <span class="pl-c">// StringBuilder res = new StringBuilder();</span>
        <span class="pl-smi">StringBuffer</span> <span class="pl-s1">res</span> = <span class="pl-k">new</span> <span class="pl-smi">StringBuffer</span>();
        <span class="pl-c">// top为 res 的长度</span>
        <span class="pl-smi">int</span> <span class="pl-s1">top</span> = -<span class="pl-c1">1</span>;
        <span class="pl-k">for</span> (<span class="pl-smi">int</span> <span class="pl-s1">i</span> = <span class="pl-c1">0</span>; <span class="pl-s1">i</span> &lt; <span class="pl-s1">s</span>.<span class="pl-en">length</span>(); <span class="pl-s1">i</span>++) {
            <span class="pl-smi">char</span> <span class="pl-s1">c</span> = <span class="pl-s1">s</span>.<span class="pl-en">charAt</span>(<span class="pl-s1">i</span>);
            <span class="pl-c">// 当 top &gt; 0,即栈中有字符时，当前字符如果和栈中字符相等，弹出栈顶字符，同时 top--</span>
            <span class="pl-k">if</span> (<span class="pl-s1">top</span> &gt;= <span class="pl-c1">0</span> &amp;&amp; <span class="pl-s1">res</span>.<span class="pl-en">charAt</span>(<span class="pl-s1">top</span>) == <span class="pl-s1">c</span>) {
                <span class="pl-s1">res</span>.<span class="pl-en">deleteCharAt</span>(<span class="pl-s1">top</span>);
                <span class="pl-s1">top</span>--;
            <span class="pl-c">// 否则，将该字符 入栈，同时top++</span>
            } <span class="pl-k">else</span> {
                <span class="pl-s1">res</span>.<span class="pl-en">append</span>(<span class="pl-s1">c</span>);
                <span class="pl-s1">top</span>++;
            }
        }
        <span class="pl-k">return</span> <span class="pl-s1">res</span>.<span class="pl-en">toString</span>();
    }
}</pre></div>
<p dir="auto">拓展：双指针</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="class Solution {
    public String removeDuplicates(String s) {
        char[] ch = s.toCharArray();
        int fast = 0;
        int slow = 0;
        while(fast &lt; s.length()){
            // 直接用fast指针覆盖slow指针的值
            ch[slow] = ch[fast];
            // 遇到前后相同值的，就跳过，即slow指针后退一步，下次循环就可以直接被覆盖掉了
            if(slow &gt; 0 &amp;&amp; ch[slow] == ch[slow - 1]){
                slow--;
            }else{
                slow++;
            }
            fast++;
        }
        return new String(ch,0,slow);
    }
}"><pre><span class="pl-k">class</span> <span class="pl-smi">Solution</span> {
    <span class="pl-k">public</span> <span class="pl-smi">String</span> <span class="pl-en">removeDuplicates</span>(<span class="pl-smi">String</span> <span class="pl-s1">s</span>) {
        <span class="pl-smi">char</span>[] <span class="pl-s1">ch</span> = <span class="pl-s1">s</span>.<span class="pl-en">toCharArray</span>();
        <span class="pl-smi">int</span> <span class="pl-s1">fast</span> = <span class="pl-c1">0</span>;
        <span class="pl-smi">int</span> <span class="pl-s1">slow</span> = <span class="pl-c1">0</span>;
        <span class="pl-k">while</span>(<span class="pl-s1">fast</span> &lt; <span class="pl-s1">s</span>.<span class="pl-en">length</span>()){
            <span class="pl-c">// 直接用fast指针覆盖slow指针的值</span>
            <span class="pl-s1">ch</span>[<span class="pl-s1">slow</span>] = <span class="pl-s1">ch</span>[<span class="pl-s1">fast</span>];
            <span class="pl-c">// 遇到前后相同值的，就跳过，即slow指针后退一步，下次循环就可以直接被覆盖掉了</span>
            <span class="pl-k">if</span>(<span class="pl-s1">slow</span> &gt; <span class="pl-c1">0</span> &amp;&amp; <span class="pl-s1">ch</span>[<span class="pl-s1">slow</span>] == <span class="pl-s1">ch</span>[<span class="pl-s1">slow</span> - <span class="pl-c1">1</span>]){
                <span class="pl-s1">slow</span>--;
            }<span class="pl-k">else</span>{
                <span class="pl-s1">slow</span>++;
            }
            <span class="pl-s1">fast</span>++;
        }
        <span class="pl-k">return</span> <span class="pl-k">new</span> <span class="pl-smi">String</span>(<span class="pl-s1">ch</span>,<span class="pl-c1">0</span>,<span class="pl-s1">slow</span>);
    }
}</pre></div>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Python：</h3><a id="user-content-python" class="anchor" aria-label="Permalink: Python：" href="#python"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="# 方法一，使用栈
class Solution:
    def removeDuplicates(self, s: str) -&gt; str:
        res = list()
        for item in s:
            if res and res[-1] == item:
                res.pop()
            else:
                res.append(item)
        return &quot;&quot;.join(res)  # 字符串拼接"><pre><span class="pl-c"># 方法一，使用栈</span>
<span class="pl-k">class</span> <span class="pl-v">Solution</span>:
    <span class="pl-k">def</span> <span class="pl-en">removeDuplicates</span>(<span class="pl-s1">self</span>, <span class="pl-s1">s</span>: <span class="pl-smi">str</span>) <span class="pl-c1">-&gt;</span> <span class="pl-smi">str</span>:
        <span class="pl-s1">res</span> <span class="pl-c1">=</span> <span class="pl-en">list</span>()
        <span class="pl-k">for</span> <span class="pl-s1">item</span> <span class="pl-c1">in</span> <span class="pl-s1">s</span>:
            <span class="pl-k">if</span> <span class="pl-s1">res</span> <span class="pl-c1">and</span> <span class="pl-s1">res</span>[<span class="pl-c1">-</span><span class="pl-c1">1</span>] <span class="pl-c1">==</span> <span class="pl-s1">item</span>:
                <span class="pl-s1">res</span>.<span class="pl-c1">pop</span>()
            <span class="pl-k">else</span>:
                <span class="pl-s1">res</span>.<span class="pl-c1">append</span>(<span class="pl-s1">item</span>)
        <span class="pl-k">return</span> <span class="pl-s">""</span>.<span class="pl-c1">join</span>(<span class="pl-s1">res</span>)  <span class="pl-c"># 字符串拼接</span></pre></div>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="# 方法二，使用双指针模拟栈，如果不让用栈可以作为备选方法。
class Solution:
    def removeDuplicates(self, s: str) -&gt; str:
        res = list(s)
        slow = fast = 0
        length = len(res)

        while fast &lt; length:
            # 如果一样直接换，不一样会把后面的填在slow的位置
            res[slow] = res[fast]
            
            # 如果发现和前一个一样，就退一格指针
            if slow &gt; 0 and res[slow] == res[slow - 1]:
                slow -= 1
            else:
                slow += 1
            fast += 1
            
        return ''.join(res[0: slow])"><pre><span class="pl-c"># 方法二，使用双指针模拟栈，如果不让用栈可以作为备选方法。</span>
<span class="pl-k">class</span> <span class="pl-v">Solution</span>:
    <span class="pl-k">def</span> <span class="pl-en">removeDuplicates</span>(<span class="pl-s1">self</span>, <span class="pl-s1">s</span>: <span class="pl-smi">str</span>) <span class="pl-c1">-&gt;</span> <span class="pl-smi">str</span>:
        <span class="pl-s1">res</span> <span class="pl-c1">=</span> <span class="pl-en">list</span>(<span class="pl-s1">s</span>)
        <span class="pl-s1">slow</span> <span class="pl-c1">=</span> <span class="pl-s1">fast</span> <span class="pl-c1">=</span> <span class="pl-c1">0</span>
        <span class="pl-s1">length</span> <span class="pl-c1">=</span> <span class="pl-en">len</span>(<span class="pl-s1">res</span>)

        <span class="pl-k">while</span> <span class="pl-s1">fast</span> <span class="pl-c1">&lt;</span> <span class="pl-s1">length</span>:
            <span class="pl-c"># 如果一样直接换，不一样会把后面的填在slow的位置</span>
            <span class="pl-s1">res</span>[<span class="pl-s1">slow</span>] <span class="pl-c1">=</span> <span class="pl-s1">res</span>[<span class="pl-s1">fast</span>]
            
            <span class="pl-c"># 如果发现和前一个一样，就退一格指针</span>
            <span class="pl-k">if</span> <span class="pl-s1">slow</span> <span class="pl-c1">&gt;</span> <span class="pl-c1">0</span> <span class="pl-c1">and</span> <span class="pl-s1">res</span>[<span class="pl-s1">slow</span>] <span class="pl-c1">==</span> <span class="pl-s1">res</span>[<span class="pl-s1">slow</span> <span class="pl-c1">-</span> <span class="pl-c1">1</span>]:
                <span class="pl-s1">slow</span> <span class="pl-c1">-=</span> <span class="pl-c1">1</span>
            <span class="pl-k">else</span>:
                <span class="pl-s1">slow</span> <span class="pl-c1">+=</span> <span class="pl-c1">1</span>
            <span class="pl-s1">fast</span> <span class="pl-c1">+=</span> <span class="pl-c1">1</span>
            
        <span class="pl-k">return</span> <span class="pl-s">''</span>.<span class="pl-c1">join</span>(<span class="pl-s1">res</span>[<span class="pl-c1">0</span>: <span class="pl-s1">slow</span>])</pre></div>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Go：</h3><a id="user-content-go" class="anchor" aria-label="Permalink: Go：" href="#go"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<div class="highlight highlight-source-go notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="func removeDuplicates(s string) string {
    var stack []byte
    for i := 0; i &lt; len(s);i++ {
        // 栈不空 且 与栈顶元素不等
        if len(stack) &gt; 0 &amp;&amp; stack[len(stack)-1] == s[i] {
            // 弹出栈顶元素 并 忽略当前元素(s[i])
            stack = stack[:len(stack)-1]
        }else{
            // 入栈
            stack = append(stack, s[i])
        }
    }
    return string(stack)
}"><pre><span class="pl-k">func</span> <span class="pl-s1">removeDuplicates</span>(<span class="pl-s1">s</span> <span class="pl-smi">string</span>) <span class="pl-smi">string</span> {
    <span class="pl-k">var</span> <span class="pl-s1">stack</span> []<span class="pl-smi">byte</span>
    <span class="pl-k">for</span> <span class="pl-s1">i</span> <span class="pl-c1">:=</span> <span class="pl-c1">0</span>; <span class="pl-s1">i</span> <span class="pl-c1">&lt;</span> <span class="pl-s1">len</span>(<span class="pl-s1">s</span>);<span class="pl-s1">i</span><span class="pl-c1">++</span> {
        <span class="pl-c">// 栈不空 且 与栈顶元素不等</span>
        <span class="pl-k">if</span> <span class="pl-s1">len</span>(<span class="pl-s1">stack</span>) <span class="pl-c1">&gt;</span> <span class="pl-c1">0</span> <span class="pl-c1">&amp;&amp;</span> <span class="pl-s1">stack</span>[<span class="pl-s1">len</span>(<span class="pl-s1">stack</span>)<span class="pl-c1">-</span><span class="pl-c1">1</span>] <span class="pl-c1">==</span> <span class="pl-s1">s</span>[<span class="pl-s1">i</span>] {
            <span class="pl-c">// 弹出栈顶元素 并 忽略当前元素(s[i])</span>
            <span class="pl-s1">stack</span> <span class="pl-c1">=</span> <span class="pl-s1">stack</span>[:<span class="pl-s1">len</span>(<span class="pl-s1">stack</span>)<span class="pl-c1">-</span><span class="pl-c1">1</span>]
        }<span class="pl-k">else</span>{
            <span class="pl-c">// 入栈</span>
            <span class="pl-s1">stack</span> <span class="pl-c1">=</span> <span class="pl-s1">append</span>(<span class="pl-s1">stack</span>, <span class="pl-s1">s</span>[<span class="pl-s1">i</span>])
        }
    }
    <span class="pl-k">return</span> <span class="pl-s1">string</span>(<span class="pl-s1">stack</span>)
}</pre></div>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">JavaScript:</h3><a id="user-content-javascript" class="anchor" aria-label="Permalink: JavaScript:" href="#javascript"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<p dir="auto">法一：使用栈</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="var removeDuplicates = function(s) {
    const result = []
    for(const i of s){
        if(i === result[result.length-1]){
            result.pop()
        }else{
            result.push(i)
        }
    }
    return result.join('')
};"><pre><span class="pl-k">var</span> <span class="pl-en">removeDuplicates</span> <span class="pl-c1">=</span> <span class="pl-k">function</span><span class="pl-kos">(</span><span class="pl-s1">s</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-k">const</span> <span class="pl-s1">result</span> <span class="pl-c1">=</span> <span class="pl-kos">[</span><span class="pl-kos">]</span>
    <span class="pl-k">for</span><span class="pl-kos">(</span><span class="pl-k">const</span> <span class="pl-s1">i</span> <span class="pl-k">of</span> <span class="pl-s1">s</span><span class="pl-kos">)</span><span class="pl-kos">{</span>
        <span class="pl-k">if</span><span class="pl-kos">(</span><span class="pl-s1">i</span> <span class="pl-c1">===</span> <span class="pl-s1">result</span><span class="pl-kos">[</span><span class="pl-s1">result</span><span class="pl-kos">.</span><span class="pl-c1">length</span><span class="pl-c1">-</span><span class="pl-c1">1</span><span class="pl-kos">]</span><span class="pl-kos">)</span><span class="pl-kos">{</span>
            <span class="pl-s1">result</span><span class="pl-kos">.</span><span class="pl-en">pop</span><span class="pl-kos">(</span><span class="pl-kos">)</span>
        <span class="pl-kos">}</span><span class="pl-k">else</span><span class="pl-kos">{</span>
            <span class="pl-s1">result</span><span class="pl-kos">.</span><span class="pl-en">push</span><span class="pl-kos">(</span><span class="pl-s1">i</span><span class="pl-kos">)</span>
        <span class="pl-kos">}</span>
    <span class="pl-kos">}</span>
    <span class="pl-k">return</span> <span class="pl-s1">result</span><span class="pl-kos">.</span><span class="pl-en">join</span><span class="pl-kos">(</span><span class="pl-s">''</span><span class="pl-kos">)</span>
<span class="pl-kos">}</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">法二：双指针（模拟栈）</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// 原地解法（双指针模拟栈）
var removeDuplicates = function(s) {
    s = [...s];
    let top = -1; // 指向栈顶元素的下标
    for(let i = 0; i &lt; s.length; i++) {
        if(top === -1 || s[top] !== s[i]) { // top === -1 即空栈
            s[++top] = s[i]; // 入栈
        } else {
            top--; // 推出栈
        }
    }
    s.length = top + 1; // 栈顶元素下标 + 1 为栈的长度
    return s.join('');
};"><pre><span class="pl-c">// 原地解法（双指针模拟栈）</span>
<span class="pl-k">var</span> <span class="pl-en">removeDuplicates</span> <span class="pl-c1">=</span> <span class="pl-k">function</span><span class="pl-kos">(</span><span class="pl-s1">s</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-s1">s</span> <span class="pl-c1">=</span> <span class="pl-kos">[</span>...<span class="pl-s1">s</span><span class="pl-kos">]</span><span class="pl-kos">;</span>
    <span class="pl-k">let</span> <span class="pl-s1">top</span> <span class="pl-c1">=</span> <span class="pl-c1">-</span><span class="pl-c1">1</span><span class="pl-kos">;</span> <span class="pl-c">// 指向栈顶元素的下标</span>
    <span class="pl-k">for</span><span class="pl-kos">(</span><span class="pl-k">let</span> <span class="pl-s1">i</span> <span class="pl-c1">=</span> <span class="pl-c1">0</span><span class="pl-kos">;</span> <span class="pl-s1">i</span> <span class="pl-c1">&lt;</span> <span class="pl-s1">s</span><span class="pl-kos">.</span><span class="pl-c1">length</span><span class="pl-kos">;</span> <span class="pl-s1">i</span><span class="pl-c1">++</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
        <span class="pl-k">if</span><span class="pl-kos">(</span><span class="pl-s1">top</span> <span class="pl-c1">===</span> <span class="pl-c1">-</span><span class="pl-c1">1</span> <span class="pl-c1">||</span> <span class="pl-s1">s</span><span class="pl-kos">[</span><span class="pl-s1">top</span><span class="pl-kos">]</span> <span class="pl-c1">!==</span> <span class="pl-s1">s</span><span class="pl-kos">[</span><span class="pl-s1">i</span><span class="pl-kos">]</span><span class="pl-kos">)</span> <span class="pl-kos">{</span> <span class="pl-c">// top === -1 即空栈</span>
            <span class="pl-s1">s</span><span class="pl-kos">[</span><span class="pl-c1">++</span><span class="pl-s1">top</span><span class="pl-kos">]</span> <span class="pl-c1">=</span> <span class="pl-s1">s</span><span class="pl-kos">[</span><span class="pl-s1">i</span><span class="pl-kos">]</span><span class="pl-kos">;</span> <span class="pl-c">// 入栈</span>
        <span class="pl-kos">}</span> <span class="pl-k">else</span> <span class="pl-kos">{</span>
            <span class="pl-s1">top</span><span class="pl-c1">--</span><span class="pl-kos">;</span> <span class="pl-c">// 推出栈</span>
        <span class="pl-kos">}</span>
    <span class="pl-kos">}</span>
    <span class="pl-s1">s</span><span class="pl-kos">.</span><span class="pl-c1">length</span> <span class="pl-c1">=</span> <span class="pl-s1">top</span> <span class="pl-c1">+</span> <span class="pl-c1">1</span><span class="pl-kos">;</span> <span class="pl-c">// 栈顶元素下标 + 1 为栈的长度</span>
    <span class="pl-k">return</span> <span class="pl-s1">s</span><span class="pl-kos">.</span><span class="pl-en">join</span><span class="pl-kos">(</span><span class="pl-s">''</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span><span class="pl-kos">;</span></pre></div>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">TypeScript：</h3><a id="user-content-typescript" class="anchor" aria-label="Permalink: TypeScript：" href="#typescript"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="function removeDuplicates(s: string): string {
    const helperStack: string[] = [];
    let i: number = 0;
    while (i &lt; s.length) {
        let top: string = helperStack[helperStack.length - 1];
        if (top === s[i]) {
            helperStack.pop();
        } else {
            helperStack.push(s[i]);
        }
        i++;
    }
    let res: string = '';
    while (helperStack.length &gt; 0) {
        res = helperStack.pop() + res;
    }
    return res;
};"><pre><span class="pl-k">function</span> <span class="pl-en">removeDuplicates</span><span class="pl-kos">(</span><span class="pl-s1">s</span>: <span class="pl-smi">string</span><span class="pl-kos">)</span>: <span class="pl-smi">string</span> <span class="pl-kos">{</span>
    <span class="pl-k">const</span> <span class="pl-s1">helperStack</span>: <span class="pl-smi">string</span><span class="pl-kos">[</span><span class="pl-kos">]</span> <span class="pl-c1">=</span> <span class="pl-kos">[</span><span class="pl-kos">]</span><span class="pl-kos">;</span>
    <span class="pl-k">let</span> <span class="pl-s1">i</span>: <span class="pl-smi">number</span> <span class="pl-c1">=</span> <span class="pl-c1">0</span><span class="pl-kos">;</span>
    <span class="pl-k">while</span> <span class="pl-kos">(</span><span class="pl-s1">i</span> <span class="pl-c1">&lt;</span> <span class="pl-s1">s</span><span class="pl-kos">.</span><span class="pl-c1">length</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
        <span class="pl-k">let</span> <span class="pl-s1">top</span>: <span class="pl-smi">string</span> <span class="pl-c1">=</span> <span class="pl-s1">helperStack</span><span class="pl-kos">[</span><span class="pl-s1">helperStack</span><span class="pl-kos">.</span><span class="pl-c1">length</span> <span class="pl-c1">-</span> <span class="pl-c1">1</span><span class="pl-kos">]</span><span class="pl-kos">;</span>
        <span class="pl-k">if</span> <span class="pl-kos">(</span><span class="pl-s1">top</span> <span class="pl-c1">===</span> <span class="pl-s1">s</span><span class="pl-kos">[</span><span class="pl-s1">i</span><span class="pl-kos">]</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
            <span class="pl-s1">helperStack</span><span class="pl-kos">.</span><span class="pl-en">pop</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
        <span class="pl-kos">}</span> <span class="pl-k">else</span> <span class="pl-kos">{</span>
            <span class="pl-s1">helperStack</span><span class="pl-kos">.</span><span class="pl-en">push</span><span class="pl-kos">(</span><span class="pl-s1">s</span><span class="pl-kos">[</span><span class="pl-s1">i</span><span class="pl-kos">]</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
        <span class="pl-kos">}</span>
        <span class="pl-s1">i</span><span class="pl-c1">++</span><span class="pl-kos">;</span>
    <span class="pl-kos">}</span>
    <span class="pl-k">let</span> <span class="pl-s1">res</span>: <span class="pl-smi">string</span> <span class="pl-c1">=</span> <span class="pl-s">''</span><span class="pl-kos">;</span>
    <span class="pl-k">while</span> <span class="pl-kos">(</span><span class="pl-s1">helperStack</span><span class="pl-kos">.</span><span class="pl-c1">length</span> <span class="pl-c1">&gt;</span> <span class="pl-c1">0</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
        <span class="pl-s1">res</span> <span class="pl-c1">=</span> <span class="pl-s1">helperStack</span><span class="pl-kos">.</span><span class="pl-en">pop</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c1">+</span> <span class="pl-s1">res</span><span class="pl-kos">;</span>
    <span class="pl-kos">}</span>
    <span class="pl-k">return</span> <span class="pl-s1">res</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span><span class="pl-kos">;</span></pre></div>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">C:</h3><a id="user-content-c" class="anchor" aria-label="Permalink: C:" href="#c"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<p dir="auto">方法一：使用栈</p>
<div class="highlight highlight-source-c notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="char * removeDuplicates(char * s){
    //求出字符串长度
    int strLength = strlen(s);
    //开辟栈空间。栈空间长度应为字符串长度+1（为了存放字符串结束标志'\0'）
    char* stack = (char*)malloc(sizeof(char) * strLength + 1);
    int stackTop = 0;

    int index = 0;
    //遍历整个字符串
    while(index &lt; strLength) {
        //取出当前index对应字母，之后index+1
        char letter = s[index++];
        //若栈中有元素，且栈顶字母等于当前字母（两字母相邻）。将栈顶元素弹出
        if(stackTop &gt; 0 &amp;&amp; letter == stack[stackTop - 1])
            stackTop--;
        //否则将字母入栈
        else
            stack[stackTop++] = letter;
    }
    //存放字符串结束标志'\0'
    stack[stackTop] = '\0';
    //返回栈本身作为字符串
    return stack;
}"><pre><span class="pl-smi">char</span> <span class="pl-c1">*</span> <span class="pl-en">removeDuplicates</span>(<span class="pl-smi">char</span> <span class="pl-c1">*</span> <span class="pl-s1">s</span>){
    <span class="pl-c">//求出字符串长度</span>
    <span class="pl-smi">int</span> <span class="pl-s1">strLength</span> <span class="pl-c1">=</span> <span class="pl-en">strlen</span>(<span class="pl-s1">s</span>);
    <span class="pl-c">//开辟栈空间。栈空间长度应为字符串长度+1（为了存放字符串结束标志'\0'）</span>
    <span class="pl-smi">char</span><span class="pl-c1">*</span> <span class="pl-s1">stack</span> <span class="pl-c1">=</span> (<span class="pl-smi">char</span><span class="pl-c1">*</span>)<span class="pl-en">malloc</span>(<span class="pl-k">sizeof</span>(<span class="pl-smi">char</span>) <span class="pl-c1">*</span> <span class="pl-s1">strLength</span> <span class="pl-c1">+</span> <span class="pl-c1">1</span>);
    <span class="pl-smi">int</span> <span class="pl-s1">stackTop</span> <span class="pl-c1">=</span> <span class="pl-c1">0</span>;

    <span class="pl-smi">int</span> <span class="pl-s1">index</span> <span class="pl-c1">=</span> <span class="pl-c1">0</span>;
    <span class="pl-c">//遍历整个字符串</span>
    <span class="pl-k">while</span>(<span class="pl-s1">index</span> <span class="pl-c1">&lt;</span> <span class="pl-s1">strLength</span>) {
        <span class="pl-c">//取出当前index对应字母，之后index+1</span>
        <span class="pl-smi">char</span> <span class="pl-s1">letter</span> <span class="pl-c1">=</span> <span class="pl-s1">s</span>[<span class="pl-s1">index</span><span class="pl-c1">++</span>];
        <span class="pl-c">//若栈中有元素，且栈顶字母等于当前字母（两字母相邻）。将栈顶元素弹出</span>
        <span class="pl-k">if</span>(<span class="pl-s1">stackTop</span> <span class="pl-c1">&gt;</span> <span class="pl-c1">0</span> <span class="pl-c1">&amp;&amp;</span> <span class="pl-s1">letter</span> <span class="pl-c1">==</span> <span class="pl-s1">stack</span>[<span class="pl-s1">stackTop</span> <span class="pl-c1">-</span> <span class="pl-c1">1</span>])
            <span class="pl-s1">stackTop</span><span class="pl-c1">--</span>;
        <span class="pl-c">//否则将字母入栈</span>
        <span class="pl-k">else</span>
            <span class="pl-s1">stack</span>[<span class="pl-s1">stackTop</span><span class="pl-c1">++</span>] <span class="pl-c1">=</span> <span class="pl-s1">letter</span>;
    }
    <span class="pl-c">//存放字符串结束标志'\0'</span>
    <span class="pl-s1">stack</span>[<span class="pl-s1">stackTop</span>] <span class="pl-c1">=</span> <span class="pl-c1">'\0'</span>;
    <span class="pl-c">//返回栈本身作为字符串</span>
    <span class="pl-k">return</span> <span class="pl-s1">stack</span>;
}</pre></div>
<p dir="auto">方法二：双指针法</p>
<div class="highlight highlight-source-c notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="char * removeDuplicates(char * s){
    //创建快慢指针
    int fast = 0;
    int slow = 0;
    //求出字符串长度
    int strLength = strlen(s);
    //遍历字符串
    while(fast &lt; strLength) {
        //将当前slow指向字符改为fast指向字符。fast指针+1
        char letter = s[slow] = s[fast++];
        //若慢指针大于0，且慢指针指向元素等于字符串中前一位元素，删除慢指针指向当前元素
        if(slow &gt; 0 &amp;&amp; letter == s[slow - 1])
            slow--;
        else
            slow++;
    }
    //在字符串结束加入字符串结束标志'\0'
    s[slow] = 0;
    return s;
}"><pre><span class="pl-smi">char</span> <span class="pl-c1">*</span> <span class="pl-en">removeDuplicates</span>(<span class="pl-smi">char</span> <span class="pl-c1">*</span> <span class="pl-s1">s</span>){
    <span class="pl-c">//创建快慢指针</span>
    <span class="pl-smi">int</span> <span class="pl-s1">fast</span> <span class="pl-c1">=</span> <span class="pl-c1">0</span>;
    <span class="pl-smi">int</span> <span class="pl-s1">slow</span> <span class="pl-c1">=</span> <span class="pl-c1">0</span>;
    <span class="pl-c">//求出字符串长度</span>
    <span class="pl-smi">int</span> <span class="pl-s1">strLength</span> <span class="pl-c1">=</span> <span class="pl-en">strlen</span>(<span class="pl-s1">s</span>);
    <span class="pl-c">//遍历字符串</span>
    <span class="pl-k">while</span>(<span class="pl-s1">fast</span> <span class="pl-c1">&lt;</span> <span class="pl-s1">strLength</span>) {
        <span class="pl-c">//将当前slow指向字符改为fast指向字符。fast指针+1</span>
        <span class="pl-smi">char</span> <span class="pl-s1">letter</span> <span class="pl-c1">=</span> <span class="pl-s1">s</span>[<span class="pl-s1">slow</span>] <span class="pl-c1">=</span> <span class="pl-s1">s</span>[<span class="pl-s1">fast</span><span class="pl-c1">++</span>];
        <span class="pl-c">//若慢指针大于0，且慢指针指向元素等于字符串中前一位元素，删除慢指针指向当前元素</span>
        <span class="pl-k">if</span>(<span class="pl-s1">slow</span> <span class="pl-c1">&gt;</span> <span class="pl-c1">0</span> <span class="pl-c1">&amp;&amp;</span> <span class="pl-s1">letter</span> <span class="pl-c1">==</span> <span class="pl-s1">s</span>[<span class="pl-s1">slow</span> <span class="pl-c1">-</span> <span class="pl-c1">1</span>])
            <span class="pl-s1">slow</span><span class="pl-c1">--</span>;
        <span class="pl-k">else</span>
            <span class="pl-s1">slow</span><span class="pl-c1">++</span>;
    }
    <span class="pl-c">//在字符串结束加入字符串结束标志'\0'</span>
    <span class="pl-s1">s</span>[<span class="pl-s1">slow</span>] <span class="pl-c1">=</span> <span class="pl-c1">0</span>;
    <span class="pl-k">return</span> <span class="pl-s1">s</span>;
}</pre></div>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Swift：</h3><a id="user-content-swift" class="anchor" aria-label="Permalink: Swift：" href="#swift"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<div class="highlight highlight-source-swift notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="func removeDuplicates(_ s: String) -&gt; String {
    var stack = [Character]()
    for c in s {
        if stack.last == c {
            stack.removeLast()
        } else {
            stack.append(c)
        }
    }
    return String(stack)
}"><pre><span class="pl-en">func</span> removeDuplicates<span class="pl-kos">(</span>_ s<span class="pl-kos">:</span> <span class="pl-smi">String</span><span class="pl-kos">)</span> <span class="pl-c1">-&gt;</span> <span class="pl-smi">String</span> <span class="pl-kos">{</span>
    <span class="pl-k">var</span> <span class="pl-s1">stack</span> <span class="pl-c1">=</span> <span class="pl-kos">[</span>Character<span class="pl-kos">]</span><span class="pl-kos">(</span><span class="pl-kos">)</span>
    <span class="pl-k">for</span> <span class="pl-s1">c</span> <span class="pl-k">in</span> s <span class="pl-kos">{</span>
        <span class="pl-k">if</span> stack<span class="pl-kos">.</span>last <span class="pl-c1">==</span> c <span class="pl-kos">{</span>
            stack<span class="pl-kos">.</span><span class="pl-en">removeLast</span><span class="pl-kos">(</span><span class="pl-kos">)</span>
        <span class="pl-kos">}</span> <span class="pl-k">else</span> <span class="pl-kos">{</span>
            stack<span class="pl-kos">.</span><span class="pl-en">append</span><span class="pl-kos">(</span>c<span class="pl-kos">)</span>
        <span class="pl-kos">}</span>
    <span class="pl-kos">}</span>
    <span class="pl-k">return</span> <span class="pl-en">String</span><span class="pl-kos">(</span>stack<span class="pl-kos">)</span>
<span class="pl-kos">}</span></pre></div>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">C#:</h3><a id="user-content-c-1" class="anchor" aria-label="Permalink: C#:" href="#c-1"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<div class="highlight highlight-source-cs notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="public string RemoveDuplicates(string s) {
        //拿字符串直接作为栈，省去了栈还要转为字符串的操作
        StringBuilder res = new StringBuilder();

        foreach(char c in s){
            if(res.Length &gt; 0 &amp;&amp; res[res.Length-1] == c){
                res.Remove(res.Length-1, 1);
            }else{
                res.Append(c);
            }
        }
       
        return res.ToString();
    }"><pre><span class="pl-k">public</span> <span class="pl-smi">string</span> <span class="pl-en">RemoveDuplicates</span><span class="pl-kos">(</span><span class="pl-smi">string</span> <span class="pl-s1">s</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
        <span class="pl-c">//拿字符串直接作为栈，省去了栈还要转为字符串的操作</span>
        <span class="pl-smi">StringBuilder</span> <span class="pl-s1">res</span> <span class="pl-c1">=</span> <span class="pl-k">new</span> <span class="pl-smi">StringBuilder</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

        <span class="pl-k">foreach</span><span class="pl-kos">(</span><span class="pl-smi">char</span> <span class="pl-s1">c</span> <span class="pl-k">in</span> <span class="pl-s1">s</span><span class="pl-kos">)</span><span class="pl-kos">{</span>
            <span class="pl-k">if</span><span class="pl-kos">(</span><span class="pl-s1">res</span><span class="pl-kos">.</span><span class="pl-s1">Length</span> <span class="pl-c1">&gt;</span> <span class="pl-c1">0</span> <span class="pl-c1">&amp;&amp;</span> <span class="pl-s1">res</span><span class="pl-kos">[</span><span class="pl-s1">res</span><span class="pl-kos">.</span><span class="pl-s1">Length</span><span class="pl-c1">-</span><span class="pl-c1">1</span><span class="pl-kos">]</span> <span class="pl-c1">==</span> <span class="pl-s1">c</span><span class="pl-kos">)</span><span class="pl-kos">{</span>
                <span class="pl-s1">res</span><span class="pl-kos">.</span><span class="pl-en">Remove</span><span class="pl-kos">(</span><span class="pl-s1">res</span><span class="pl-kos">.</span><span class="pl-s1">Length</span><span class="pl-c1">-</span><span class="pl-c1">1</span><span class="pl-kos">,</span> <span class="pl-c1">1</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
            <span class="pl-kos">}</span><span class="pl-k">else</span><span class="pl-kos">{</span>
                <span class="pl-s1">res</span><span class="pl-kos">.</span><span class="pl-en">Append</span><span class="pl-kos">(</span><span class="pl-s1">c</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
            <span class="pl-kos">}</span>
        <span class="pl-kos">}</span>
       
        <span class="pl-k">return</span> <span class="pl-s1">res</span><span class="pl-kos">.</span><span class="pl-en">ToString</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-kos">}</span></pre></div>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">PHP:</h3><a id="user-content-php" class="anchor" aria-label="Permalink: PHP:" href="#php"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<div class="highlight highlight-text-html-php notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="class Solution {
    function removeDuplicates($s) {
        $stack = new SplStack();
        for($i=0;$i&lt;strlen($s);$i++){
            if($stack-&gt;isEmpty() || $s[$i] != $stack-&gt;top()){
                $stack-&gt;push($s[$i]);
            }else{
               $stack-&gt;pop(); 
            }
        }

        $result = &quot;&quot;;
        while(!$stack-&gt;isEmpty()){
            $result.= $stack-&gt;top();
            $stack-&gt;pop();
        }
        
        // 此时字符串需要反转一下
        return strrev($result);
    }
}"><pre><span class="pl-k">class</span> Solution {
    <span class="pl-k">function</span> <span class="pl-en">removeDuplicates</span>(<span class="pl-s1"><span class="pl-c1">$</span>s</span>) {
        <span class="pl-s1"><span class="pl-c1">$</span>stack</span> = <span class="pl-k">new</span> <span class="pl-v">SplStack</span>();
        <span class="pl-k">for</span>(<span class="pl-s1"><span class="pl-c1">$</span>i</span>=<span class="pl-c1">0</span>;<span class="pl-s1"><span class="pl-c1">$</span>i</span>&lt;<span class="pl-en">strlen</span>(<span class="pl-s1"><span class="pl-c1">$</span>s</span>);<span class="pl-s1"><span class="pl-c1">$</span>i</span>++){
            <span class="pl-k">if</span>(<span class="pl-s1"><span class="pl-c1">$</span>stack</span>-&gt;<span class="pl-en">isEmpty</span>() || <span class="pl-s1"><span class="pl-c1">$</span>s</span>[<span class="pl-s1"><span class="pl-c1">$</span>i</span>] != <span class="pl-s1"><span class="pl-c1">$</span>stack</span>-&gt;<span class="pl-en">top</span>()){
                <span class="pl-s1"><span class="pl-c1">$</span>stack</span>-&gt;<span class="pl-en">push</span>(<span class="pl-s1"><span class="pl-c1">$</span>s</span>[<span class="pl-s1"><span class="pl-c1">$</span>i</span>]);
            }<span class="pl-k">else</span>{
               <span class="pl-s1"><span class="pl-c1">$</span>stack</span>-&gt;<span class="pl-en">pop</span>(); 
            }
        }

        <span class="pl-s1"><span class="pl-c1">$</span>result</span> = <span class="pl-s">""</span>;
        <span class="pl-k">while</span>(!<span class="pl-s1"><span class="pl-c1">$</span>stack</span>-&gt;<span class="pl-en">isEmpty</span>()){
            <span class="pl-s1"><span class="pl-c1">$</span>result</span>.= <span class="pl-s1"><span class="pl-c1">$</span>stack</span>-&gt;<span class="pl-en">top</span>();
            <span class="pl-s1"><span class="pl-c1">$</span>stack</span>-&gt;<span class="pl-en">pop</span>();
        }
        
        <span class="pl-c">// 此时字符串需要反转一下</span>
        <span class="pl-k">return</span> <span class="pl-en">strrev</span>(<span class="pl-s1"><span class="pl-c1">$</span>result</span>);
    }
}</pre></div>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Scala:</h3><a id="user-content-scala" class="anchor" aria-label="Permalink: Scala:" href="#scala"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<div class="highlight highlight-source-scala notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="object Solution {
  import scala.collection.mutable
  def removeDuplicates(s: String): String = {
    var stack = mutable.Stack[Int]()
    var str = &quot;&quot; // 保存最终结果
    for (i &lt;- s.indices) {
      var tmp = s(i)
      // 如果栈非空并且栈顶元素等于当前字符，那么删掉栈顶和字符串最后一个元素
      if (!stack.isEmpty &amp;&amp; tmp == stack.head) {
        str = str.take(str.length - 1)
        stack.pop()
      } else {
        stack.push(tmp)
        str += tmp
      }
    }
    str
  }
}"><pre><span class="pl-k">object</span> <span class="pl-en">Solution</span> {
  <span class="pl-k">import</span> <span class="pl-en">scala</span>.<span class="pl-en">collection</span>.<span class="pl-en">mutable</span>
  <span class="pl-k">def</span> <span class="pl-en">removeDuplicates</span>(<span class="pl-v">s</span>: <span class="pl-en">String</span>)<span class="pl-k">:</span> <span class="pl-en">String</span> <span class="pl-k">=</span> {
    <span class="pl-k">var</span> <span class="pl-v">stack</span> <span class="pl-k">=</span> mutable.<span class="pl-en">Stack</span>[<span class="pl-en">Int</span>]()
    <span class="pl-k">var</span> <span class="pl-v">str</span> <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">"</span><span class="pl-pds">"</span></span> <span class="pl-c"><span class="pl-c">//</span> 保存最终结果</span>
    <span class="pl-k">for</span> (i <span class="pl-k">&lt;-</span> s.indices) {
      <span class="pl-k">var</span> <span class="pl-v">tmp</span> <span class="pl-k">=</span> s(i)
      <span class="pl-c"><span class="pl-c">//</span> 如果栈非空并且栈顶元素等于当前字符，那么删掉栈顶和字符串最后一个元素</span>
      <span class="pl-k">if</span> (<span class="pl-k">!</span>stack.isEmpty <span class="pl-k">&amp;&amp;</span> tmp <span class="pl-k">==</span> stack.head) {
        str <span class="pl-k">=</span> str.take(str.length <span class="pl-k">-</span> <span class="pl-c1">1</span>)
        stack.pop()
      } <span class="pl-k">else</span> {
        stack.push(tmp)
        str <span class="pl-k">+=</span> tmp
      }
    }
    str
  }
}</pre></div>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Rust:</h3><a id="user-content-rust" class="anchor" aria-label="Permalink: Rust:" href="#rust"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="impl Solution {
    pub fn remove_duplicates(s: String) -&gt; String {
        let mut stack = vec![];
        let mut chars: Vec&lt;char&gt; = s.chars().collect();
        while let Some(c) = chars.pop() {
            if stack.is_empty() || stack[stack.len() - 1] != c {
                stack.push(c);
            } else {
                stack.pop();
            }
        }
        stack.into_iter().rev().collect()
    }
}"><pre><span class="pl-k">impl</span> <span class="pl-smi">Solution</span> <span class="pl-kos">{</span>
    <span class="pl-k">pub</span> <span class="pl-k">fn</span> <span class="pl-en">remove_duplicates</span><span class="pl-kos">(</span><span class="pl-s1">s</span><span class="pl-kos">:</span> <span class="pl-smi">String</span><span class="pl-kos">)</span> -&gt; <span class="pl-smi">String</span> <span class="pl-kos">{</span>
        <span class="pl-k">let</span> <span class="pl-k">mut</span> stack = <span class="pl-en">vec</span><span class="pl-en">!</span><span class="pl-kos">[</span><span class="pl-kos">]</span><span class="pl-kos">;</span>
        <span class="pl-k">let</span> <span class="pl-k">mut</span> chars<span class="pl-kos">:</span> <span class="pl-smi">Vec</span><span class="pl-kos">&lt;</span><span class="pl-smi">char</span><span class="pl-kos">&gt;</span> = s<span class="pl-kos">.</span><span class="pl-en">chars</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">collect</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
        <span class="pl-k">while</span> <span class="pl-k">let</span> <span class="pl-v">Some</span><span class="pl-kos">(</span>c<span class="pl-kos">)</span> = chars<span class="pl-kos">.</span><span class="pl-en">pop</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
            <span class="pl-k">if</span> stack<span class="pl-kos">.</span><span class="pl-en">is_empty</span><span class="pl-kos">(</span><span class="pl-kos">)</span> || stack<span class="pl-kos">[</span>stack<span class="pl-kos">.</span><span class="pl-en">len</span><span class="pl-kos">(</span><span class="pl-kos">)</span> - <span class="pl-c1">1</span><span class="pl-kos">]</span> != c <span class="pl-kos">{</span>
                stack<span class="pl-kos">.</span><span class="pl-en">push</span><span class="pl-kos">(</span>c<span class="pl-kos">)</span><span class="pl-kos">;</span>
            <span class="pl-kos">}</span> <span class="pl-k">else</span> <span class="pl-kos">{</span>
                stack<span class="pl-kos">.</span><span class="pl-en">pop</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
            <span class="pl-kos">}</span>
        <span class="pl-kos">}</span>
        stack<span class="pl-kos">.</span><span class="pl-en">into_iter</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">rev</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">collect</span><span class="pl-kos">(</span><span class="pl-kos">)</span>
    <span class="pl-kos">}</span>
<span class="pl-kos">}</span></pre></div>
<div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Ruby</h3><a id="user-content-ruby" class="anchor" aria-label="Permalink: Ruby" href="#ruby"><svg data-component="Octicon" class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div>
<div class="highlight highlight-source-ruby notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="def remove_duplicates(s)
  #数组模拟栈
  stack = []
  s.each_char do |chr|
    if stack.empty?
      stack.push chr
    else
      head = stack.pop 
      #重新进栈
      stack.push head, chr if head != chr
    end
  end

  return stack.join
end"><pre><span class="pl-k">def</span> <span class="pl-en">remove_duplicates</span><span class="pl-kos">(</span><span class="pl-s1">s</span><span class="pl-kos">)</span>
  <span class="pl-c">#数组模拟栈</span>
  <span class="pl-s1">stack</span> <span class="pl-c1">=</span> <span class="pl-kos">[</span><span class="pl-kos">]</span>
  <span class="pl-s1">s</span><span class="pl-kos">.</span><span class="pl-en">each_char</span> <span class="pl-k">do</span> |<span class="pl-s1">chr</span>|
    <span class="pl-k">if</span> <span class="pl-s1">stack</span><span class="pl-kos">.</span><span class="pl-en">empty?</span>
      <span class="pl-s1">stack</span><span class="pl-kos">.</span><span class="pl-en">push</span> <span class="pl-s1">chr</span>
    <span class="pl-k">else</span>
      <span class="pl-s1">head</span> <span class="pl-c1">=</span> <span class="pl-s1">stack</span><span class="pl-kos">.</span><span class="pl-en">pop</span> 
      <span class="pl-c">#重新进栈</span>
      <span class="pl-s1">stack</span><span class="pl-kos">.</span><span class="pl-en">push</span> <span class="pl-s1">head</span><span class="pl-kos">,</span> <span class="pl-s1">chr</span> <span class="pl-k">if</span> <span class="pl-s1">head</span> != <span class="pl-s1">chr</span>
    <span class="pl-k">end</span>
  <span class="pl-k">end</span>

  <span class="pl-k">return</span> <span class="pl-s1">stack</span><span class="pl-kos">.</span><span class="pl-en">join</span>
<span class="pl-k">end</span></pre></div>
<p align="center" dir="auto">
<a href="https://programmercarl.com/other/kstar.html" rel="nofollow">
  <img src="/feinan/leetcode-master/raw/master/pics/网站星球宣传海报.jpg" width="1000" style="max-width: 100%;">
</a>
</p></article></div><div class="d-none"></div></section></div></div></div> </div> <!-- --> </div></div></div></div></div></div><div class="ScrollMarksContainer-module__scrollMarksContainer__Eu7uU" id="find-result-marks-container"></div><div class="d-none"></div><div class="d-none"></div></div> <!-- --> <!-- --> </div>
</react-app>




  </div>

</turbo-frame>

    </main>
  </div>

  </div>

          <footer class="footer f6 color-fg-muted color-border-subtle tmp-pt-7 tmp-pb-6 p-responsive" role="contentinfo"  >
  <h2 class='sr-only'>Footer</h2>

  


  <div class="d-flex flex-justify-center flex-items-center flex-column-reverse flex-lg-row flex-wrap flex-lg-nowrap">
    <div class="d-flex flex-items-center flex-shrink-0 mx-2">
      <a aria-label="GitHub Homepage" class="footer-octicon mr-2" href="https://github.com">
        <svg aria-hidden="true" data-component="Octicon" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-mark-github">
    <path d="M10.226 17.284c-2.965-.36-5.054-2.493-5.054-5.256 0-1.123.404-2.336 1.078-3.144-.292-.741-.247-2.314.09-2.965.898-.112 2.111.36 2.83 1.01.853-.269 1.752-.404 2.853-.404 1.1 0 1.999.135 2.807.382.696-.629 1.932-1.1 2.83-.988.315.606.36 2.179.067 2.942.72.854 1.101 2 1.101 3.167 0 2.763-2.089 4.852-5.098 5.234.763.494 1.28 1.572 1.28 2.807v2.336c0 .674.561 1.056 1.235.786 4.066-1.55 7.255-5.615 7.255-10.646C23.5 6.188 18.334 1 11.978 1 5.62 1 .5 6.188.5 12.545c0 4.986 3.167 9.12 7.435 10.669.606.225 1.19-.18 1.19-.786V20.63a2.9 2.9 0 0 1-1.078.224c-1.483 0-2.359-.808-2.987-2.313-.247-.607-.517-.966-1.034-1.033-.27-.023-.359-.135-.359-.27 0-.27.45-.471.898-.471.652 0 1.213.404 1.797 1.235.45.651.921.943 1.483.943.561 0 .92-.202 1.437-.719.382-.381.674-.718.944-.943"></path>
</svg>
</a>
      <span>
        &copy; 2026 GitHub,&nbsp;Inc.
      </span>
    </div>

    <nav aria-label="Footer">
      <h3 class="sr-only" id="sr-footer-heading">Footer navigation</h3>

      <ul class="list-style-none d-flex flex-justify-center flex-wrap mb-2 mb-lg-0" aria-labelledby="sr-footer-heading">


          <li class="mx-2">
            <a data-analytics-event="{&quot;category&quot;:&quot;Footer&quot;,&quot;action&quot;:&quot;go to Terms&quot;,&quot;label&quot;:&quot;text:terms&quot;}" href="https://docs.github.com/site-policy/github-terms/github-terms-of-service" data-view-component="true" class="Link--secondary Link">Terms</a>
          </li>

          <li class="mx-2">
            <a data-analytics-event="{&quot;category&quot;:&quot;Footer&quot;,&quot;action&quot;:&quot;go to privacy&quot;,&quot;label&quot;:&quot;text:privacy&quot;}" href="https://docs.github.com/site-policy/privacy-policies/github-privacy-statement" data-view-component="true" class="Link--secondary Link">Privacy</a>
          </li>


            <li class="mx-2">
              <a data-analytics-event="{&quot;category&quot;:&quot;Footer&quot;,&quot;action&quot;:&quot;go to security&quot;,&quot;label&quot;:&quot;text:security&quot;}" href="https://github.com/security" data-view-component="true" class="Link--secondary Link">Security</a>
            </li>

            <li class="mx-2">
              <a data-analytics-event="{&quot;category&quot;:&quot;Footer&quot;,&quot;action&quot;:&quot;go to status&quot;,&quot;label&quot;:&quot;text:status&quot;}" href="https://www.githubstatus.com/" data-view-component="true" class="Link--secondary Link">Status</a>
            </li>

          <li class="mx-2">
            <a data-analytics-event="{&quot;category&quot;:&quot;Footer&quot;,&quot;action&quot;:&quot;go to community&quot;,&quot;label&quot;:&quot;text:community&quot;}" href="https://github.community/" data-view-component="true" class="Link--secondary Link">Community</a>
          </li>

          <li class="mx-2">
            <a data-analytics-event="{&quot;category&quot;:&quot;Footer&quot;,&quot;action&quot;:&quot;go to docs&quot;,&quot;label&quot;:&quot;text:docs&quot;}" href="https://docs.github.com/" data-view-component="true" class="Link--secondary Link">Docs</a>
          </li>

          <li class="mx-2">
            <a data-analytics-event="{&quot;category&quot;:&quot;Footer&quot;,&quot;action&quot;:&quot;go to contact&quot;,&quot;label&quot;:&quot;text:contact&quot;}" href="https://support.github.com?tags=dotcom-footer" data-view-component="true" class="Link--secondary Link">Contact</a>
          </li>

          
<li class="mx-2" >
  <cookie-consent-link>
    <button
      type="button"
      class="Link--secondary underline-on-hover border-0 p-0 color-bg-transparent"
      data-action="click:cookie-consent-link#showConsentManagement"
      data-analytics-event="{&quot;location&quot;:&quot;footer&quot;,&quot;action&quot;:&quot;cookies&quot;,&quot;context&quot;:&quot;subfooter&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;label&quot;:&quot;cookies_link_subfooter_footer&quot;}"
    >
      Manage cookies
    </button>
  </cookie-consent-link>
</li>

  <li class="mx-2">
    <cookie-consent-link>
      <button
        type="button"
        class="Link--secondary underline-on-hover border-0 p-0 color-bg-transparent text-left"
        data-action="click:cookie-consent-link#showConsentManagement"
        data-analytics-event="{&quot;location&quot;:&quot;footer&quot;,&quot;action&quot;:&quot;dont_share_info&quot;,&quot;context&quot;:&quot;subfooter&quot;,&quot;tag&quot;:&quot;link&quot;,&quot;label&quot;:&quot;dont_share_info_link_subfooter_footer&quot;}"
      >
        Do not share my personal information
      </button>
    </cookie-consent-link>
  </li>

      </ul>
    </nav>
  </div>
</footer>



    <ghcc-consent id="ghcc" class="position-fixed bottom-0 left-0" style="z-index: 999999"
      data-locale="en"
      data-initial-cookie-consent-allowed=""
      data-cookie-consent-required="true"
    ></ghcc-consent>




  <div id="ajax-error-message" class="ajax-error-message flash flash-error" hidden>
    <svg aria-hidden="true" data-component="Octicon" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-alert">
    <path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path>
</svg>
    <button type="button" class="flash-close js-ajax-error-dismiss" aria-label="Dismiss error">
      <svg aria-hidden="true" data-component="Octicon" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x">
    <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path>
</svg>
    </button>
    You can’t perform that action at this time.
  </div>

    <template id="site-details-dialog">
  <details class="details-reset details-overlay details-overlay-dark lh-default color-fg-default hx_rsm" open>
    <summary role="button" aria-label="Close dialog"></summary>
    <details-dialog class="Box Box--overlay d-flex flex-column anim-fade-in fast hx_rsm-dialog hx_rsm-modal">
      <button class="Box-btn-octicon m-0 btn-octicon position-absolute right-0 top-0" type="button" aria-label="Close dialog" data-close-dialog>
        <svg aria-hidden="true" data-component="Octicon" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x">
    <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path>
</svg>
      </button>
      <div class="octocat-spinner tmp-my-6 js-details-dialog-spinner"></div>
    </details-dialog>
  </details>
</template>

    <div class="Popover js-hovercard-content position-absolute" style="display: none; outline: none;">
  <div class="Popover-message Popover-message--bottom-left Popover-message--large Box color-shadow-large" style="width:360px;">
  </div>
</div>

    <template id="snippet-clipboard-copy-button">
  <div class="zeroclipboard-container position-absolute right-0 top-0">
    <clipboard-copy aria-label="Copy code to clipboard" class="ClipboardButton btn js-clipboard-copy m-2 p-0" data-copy-feedback="Copied!" data-tooltip-direction="w">
      <svg aria-hidden="true" data-component="Octicon" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-copy js-clipboard-copy-icon m-2 tmp-m-2">
    <path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path>
</svg>
      <svg aria-hidden="true" data-component="Octicon" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-check js-clipboard-check-icon color-fg-success d-none m-2 tmp-m-2">
    <path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"></path>
</svg>
    </clipboard-copy>
  </div>
</template>
<template id="snippet-clipboard-copy-button-unpositioned">
  <div class="zeroclipboard-container">
    <clipboard-copy aria-label="Copy code to clipboard" class="ClipboardButton btn btn-invisible js-clipboard-copy m-2 p-0 d-flex flex-justify-center flex-items-center" data-copy-feedback="Copied!" data-tooltip-direction="w">
      <svg aria-hidden="true" data-component="Octicon" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-copy js-clipboard-copy-icon">
    <path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path>
</svg>
      <svg aria-hidden="true" data-component="Octicon" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-check js-clipboard-check-icon color-fg-success d-none">
    <path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"></path>
</svg>
    </clipboard-copy>
  </div>
</template>




    </div>
    <div id="js-global-screen-reader-notice" class="sr-only mt-n1" aria-live="polite" aria-atomic="true" ></div>
    <div id="js-global-screen-reader-notice-assertive" class="sr-only mt-n1" aria-live="assertive" aria-atomic="true"></div>
  </body>
</html>

