Node Disconnection

Company: Intuit_16march

Difficulty: medium

Problem Statement

Node Disconnection Problem Description A compromised communication network has to be secured by disconnecting all of its nodes. The nodes form a series, written as a string series of lowercase English letters; each letter is one node. In a single operation you choose any number of adjacent nodes that all carry the same letter (a non-empty contiguous block of equal letters, which may be a whole run of that letter or only part of it) and disconnect them. The disconnected nodes are removed, and the nodes on both sides of the removed block become adjacent. Letters that become neighbours this way can be disconnected together in a later operation. Find the minimum number of operations required to disconnect all of the nodes. Complete the function getMinOperations(series) , which receives the string series and returns the minimum number of operations. Input Format Read from standard input. series A single line contains the string series . Output Format Print one integer: the minimum number of