問題一覧 > 通常問題

No.2778 Is there Same letter?

レベル : / AI推定難易度 : 98 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (解説公開後に AC するまで非表示) / 解いたユーザー数 179
作問者 : yuusaan / テスター : 👑 amentorimaru 👑 seekworser
お気に入りにしたユーザー ProblemId : 10469 / 自分の提出
問題文最終更新日: 2024-06-05 08:26:32
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 432 (順位表) の他の問題:

Story

Now, let us talk about Yu~-san's past.

Yu~-san has no good memories of romantic relationships.

On top of that, having had almost nothing to do with girls during high school and university, Yu~-san became terribly twisted.

Yes, Yu~-san can no longer tolerate compatible people being in the same space. The same goes for strings.

In other words, Yu~-san cannot tolerate a string containing multiple occurrences of the same letter.

Your job is to determine whether a given string is one that Yu~-san will tolerate or not, before it comes into Yu~-san's sight.

Problem Statement

You are given a string $S$ of $N$ characters.

Determine whether the same letter appears $2$ or more times in the string $S$.

More strictly, it is as follows.

  • Determine whether there exists a pair of integers $( i , j )( 1\leq i< j\leq N )$ such that the $i$-th and $j$-th characters of $S$ are identical.
  • Input

    $N$
    $S$
    

    Constraints

    • $N$ is an integer.
    • $S$ is a string consisting of uppercase English letters.
    • $2\leqq N\leqq 26$
    • $|S| = N$

    Output

    Print Yes if the same letter appears $2$ or more times, and No otherwise. Print a newline at the end.

    Sample

    Sample 1
    Input
    5
    TOKYO
    Output
    Yes

    Since O appears $2$ times, print Yes.

    Sample 2
    Input
    7
    ATCODER
    Output
    No

    No letter appears $2$ or more times in ATCODER.

    Sample 3
    Input
    19
    QAWSEDRFTGYHUJIKOLP
    Output
    No

    提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。