/home/caleb/ASDV-Java/Semester 3/Assignments/Lab_CalebFontenot_MaximumOrderedString/src/main/java/edu/slcc/asdv/caleb/lab_calebfontenot_maximumorderedstring/FindMaxOrderedSubstring.java
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package edu.slcc.asdv.caleb.lab_calebfontenot_maximumorderedstring;

import java.util.ArrayList;
import java.util.Collections;

/**
 *
 * @author caleb
 */
public class FindMaxOrderedSubstring {

    public static String findMaxOrderedSubString(String input) {
        String outputString = "";
        int j = 0;
        for (int i = 0; i < input.length(); ++i) {
            if (i == 0) {
                outputString += input.charAt(i);
            }
            if (input.charAt(i) > outputString.charAt(j)) {
                ++j;
                outputString += input.charAt(i);
            }
        }
        return outputString;
    }

    public static void main(String[] args) {
        System.out.println(findMaxOrderedSubString("Welcome!"));
    }
}