#4Cybersecurity Log Pattern Detection
A cybersecurity monitoring system continuously analyzes strings generated from login attempts, access tokens, device identifiers, and security event logs. During analysis, the system looks for symmetric patterns inside a security log. A pattern is considered symmetric if it reads exactly the same from left to right and from right to left.
Given a security log string s, find the longest contiguous symmetric pattern in the log. If multiple symmetric patterns have the same maximum length, return any one of them.
Examples
Example 1
Input: s = "X7ABCCBA9"
Output: "ABCCBA"
Explanation: "ABCCBA" reads the same from both directions and is the longest symmetric pattern in the security log.
Example 2
Input: s = "LOG12321END"
Output: "12321"
Explanation: "12321" is a symmetric security pattern.
Constraints
- 1 <= s.length <= 1000
- s consist of only digits and English letters.
- Matching is case-sensitive.
- The detected pattern must be a contiguous substring of s.
