[中山市赛 2023] 同质

Luogu
IDLGB4333
Time1000ms
Memory512MB
DifficultyP1
模拟2023广东科创活动小学活动
给定一个仅由小写字母组成的字符串 $s$,求 $s$ 中最长的子串的长度,满足子串中所有字母均相等。 ## Input 一行一个字符串 $s$。 ## Output 一行一个整数,表示答案。 [samples] ## Note ### 样例解释 $\tt aabaaaccdd$ 中满足所有字母相等的子串有 $\tt a$,$\tt aa$,$\tt aaa$,$\tt b$,$\tt c$,$\tt cc$,$\tt d$,$\tt dd$,其中最长的是 $\tt aaa$,所以答案为 $3$。 ### 数据范围 对于 $20\%$ 数据,满足 $1\le |s|\le 100$。 对于 $40\%$ 数据,满足 $1\le |s|\le 1000$。 对于 $100\%$ 数据,满足 $1\le |s|\le 10^6$。
Samples
Input #1
aabaaaccdd
Output #1
3
API Response (JSON)
{
  "problem": {
    "name": "[中山市赛 2023] 同质",
    "description": {
      "content": "给定一个仅由小写字母组成的字符串 $s$,求 $s$ 中最长的子串的长度,满足子串中所有字母均相等。",
      "description_type": "Markdown"
    },
    "platform": "Luogu",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 524288
    },
    "difficulty": {
      "LuoguStyle": "P1"
    },
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "LGB4333"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "给定一个仅由小写字母组成的字符串 $s$,求 $s$ 中最长的子串的长度,满足子串中所有字母均相等。\n\n## Input\n\n一行一个字符串 $s$。\n\n## Output\n\n一行一个整数,表示答案。\n\n[samples]\n\n## Note\n\n### 样例解释\n\n$\\tt aabaaaccdd$ 中满足所有字母相等的子串有 $\\tt a$,$\\tt aa$,$\\tt aaa$,$\\tt b$,$\\t...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments