Driver Code
public static void main ( String [ ] args ) throws IOException { String inputs [ ] = { " IDID " , " I " , " DD " , " II " , " DIDI " , " IIDDD " , " DDIDDIID " } ; for ( String input : inputs ) { System . out . println ( getMinNumberForPattern ( input ) ) ; } } }