You are given a string s and a printer that works in turns. In one turn, the printer selects a contiguous segment of s and prints a single lowercase letter across the entire segment. Any characters already present in that segment are overwritten.
Return the minimum number of turns needed to print s starting from an initially empty string.
Note: The printer can overwrite previously printed characters.
Constraints:
s.length
s consists of lowercase English letters.
You are given a string s and a printer that works in turns. In one turn, the printer selects a contiguous segment of s and prints a single lowercase letter across the entire segment. Any characters already present in that segment are overwritten.
Return the minimum number of turns needed to print s starting from an initially empty string.
Note: The printer can overwrite previously printed characters.
Constraints:
s.length
s consists of lowercase English letters.