private static String removeAdjDupsHelper(String str, char lastRemoved)
    {
        if (str.isEmpty() || str.length() == 1)
        {
            return str;
        }
        
        if (str.charAt(0) == str.charAt(1))
        {
            lastRemoved = str.charAt(0);
            String strSub = str.substring(0);
            while (!strSub.isEmpty() && strSub.charAt(0) == strSub.charAt(1))
            {
                strSub = strSub.substring(1);
            }
            strSub = strSub.substring(1);
            return removeAdjDupsHelper(strSub, lastRemoved);
        }
        
        String remStr = removeAdjDupsHelper(str.substring(1), lastRemoved);
        
        if (!remStr.isEmpty() && remStr.charAt(0) == str.charAt(0))
        {
            lastRemoved = str.charAt(0);
            return (remStr.substring(1)); // Remove first character
        }
        
        if (remStr.isEmpty() && lastRemoved == str.charAt(0))
         return remStr;
        
        remStr = str.charAt(0) + remStr;
        
        return remStr;
    }