Strange Printer
A strange printer can only print a sequence of the same character each turn. At each turn, the printer can print new characters starting from and ending at any place and will cover the original existing characters. Given a string s, return the minimum number of turns the printer needs to print it.
Strange Printer

A strange printer can only print a sequence of the same character each turn. At each turn, the printer can print new characters starting from and ending at any place and will cover the original existing characters. Given a string s, return the minimum number of turns the printer needs to print it.

Example 1:
Input: {"s":"aaabbb"}
Output: 2
Input
arr ={"s":"aaabbb"}

String: "aaabbb"

String Characters

a

0

a

1

a

2

b

3

b

4

b

5

dp[i][j] = minimum turns to print s[i..j]

Variables
No variables to display
DepthFunction Call
Stack empty
0/1