KATO-Hiro / Somen-Soupy

Python3 implementation of competitive programming library inspired by spaghetti-source/algorithm
Creative Commons Zero v1.0 Universal
1 stars 1 forks source link

回文の判定 #359

Open KATO-Hiro opened 1 year ago

KATO-Hiro commented 1 year ago
    s = input().rstrip()
    n = len(s)
    ans = 1

    for i in range(n + 1):
        for j in range(i + 1, n + 1):
            t = s[i:j]

            if t == t[::-1]:
                ans = max(ans, len(t))