#K88957. Longest Substring with At Most Two Distinct Characters
Longest Substring with At Most Two Distinct Characters
Longest Substring with At Most Two Distinct Characters
Given a string s
, your task is to find the length of the longest substring that contains at most two distinct characters.
You are required to read the input string from standard input and print the result to standard output.
Note: A substring is a contiguous sequence of characters within the string.
The problem should be solved by applying a sliding window technique.
inputFormat
The input consists of a single line containing a non-empty string s
. The string may contain any characters.
outputFormat
Print a single integer representing the length of the longest substring that contains at most two distinct characters.
## sampleeceba
3