Sponsored
Use these hints if you're stuck. Try solving on your own first.
Since n is small, we can simply simulate the process of constructing S1 to Sn.
Solve with full IDE support and test cases