Splitting uppercase letters based on a dictionary A few days ago I learned about the dynamic programming approach to problem-solving; the thing is, I'm still not sure I am fully grasping the concept.

I decided to write an algorithm that takes a single String of uppercase letters, s, and split it into substrings based on a dictionary I have provided. My algorithm works as expected, although I'm not sure if i'm using the dynamic programming approach correctly. From what I understand, DP uses an array which holds solutions to the subproblems of a larger problem. This was my goal with the result array. Here is my simple program to demonstrate a solution to the problem:

import java.util.Scanner;

class WordBreak
{

    static String[] result;
    static String[] dictionary = {"I", "THE", "ABORT", "PLAN", "MEET", "CONFIRM", "AT",
                                  "DARK", "CABIN", "PROCEED", "MISSION", "MISS",
                                  "CHOCOLATE", "ALIENS", "CANNIBALS", "SAUCE"};

    public static void main(String[] args)
    {
        Scanner in = new Scanner(System.in);
        String str = in.next();
        int size = str.length();
        result = new String[size];
        print(str, 0);
    }
    //method which recursively breaks input string into substrings
    //which are stored in an array and, if they are English words, then printed
    static void print(String str, int ind)
    {
        //each recursive call shortens the input string until length is 0
        int length = str.length();
        //if length is 0, then print the resulting substrings to decode
        //the message
        if(length == 0)
        {
            for(int i = 0; i &lt; ind; i++)
            {
                System.out.print(result[i] + " ");
            }
            System.out.println();
            return;
        }
        //if a valid substring of the dictionary, add it to result array and recur
        for(int i = 1; i &lt;= length; i++)
        {
            if(valid(str.substring(0, i)) == true)
            {
                result[ind] = str.substring(0, i);
                print(str.substring(i), ind + 1);
            }
        }
    }
    //valid function returns true iff string s is an English word (in the dictionary)
    static boolean valid(String s)
    {
        boolean result = false;

        for(int i = 0; i &lt; dictionary.length; i++)
        {
            if(s.equals(dictionary[i]))
            {
                result = true;
                break;
            }
        }
        return result;
    }
}


Given the input string of "ABORTTHEPLANMEETATTHEDARKCABIN" the algorithm does accurately print out "ABORT THE PLAN MEET AT THE DARK CABIN".

My question is, is this a proper dynamic programming approach? If not, what potential changes could I make to implement DP? My main goal here is to make sure I am effectively grasping the concept.

Lastly (kind of off topic), what would the big O of this algorithm be? My analysis tells me either \$O(n^2)\$ or \$O(n^3)\$ depending on how you look at the substring(i, j) method call. This is for my own curiosity to see if I'm analyzing it correctly.
Your big O is roughly O(N^2) if you consider your dictionary to be static.  

I don't see anything in your solution that I would classify as dynamic programming.  Maybe you could make a DP solution by pre-parsing your dictionary so you don't check substrings multiple times but instead check each letter against each still-matching word.  Some more test cases might turn up some interesting bugs, too.