class Palindrome:
    """
    plist is a list of palindromes derived from a string.
    trivial is the count of all single letter palindromes.
    """
    def __init__(self):
    	self.plist = []
    	self.trivial = 0
		
    def isPalindrome(self, aString):
        """
        Assumes aString has length greater than 0. Will return True if aString is a single letter.
        """
        limit = len(aString)
        i = 0
        j = limit - 1
    	
        while i < j:
            if aString[i] != aString[j]:
            	return False
            i += 1
            j -= 1
        return True

    def substrings(self, aString):
        """
        Does nothing if aString is empty string. Otherwise generates a list of unique substrings of aString that are palindromes.
        """
        limit = len(aString)
        i = 0
        j = i + 1
        while i < limit:
            x = aString[i:j]
            if self.isPalindrome(x):
                if x not in self.plist:
                    if len(x)== 1:
                	    self.trivial += 1
                    self.plist.append(x)
            j += 1
            if j >= limit:
                i += 1
                j = i + 1
    	
if __name__ == "__main__":
    me = Palindrome()
    me.substrings("boogaloo")
    print(me.plist)
    print(me.trivial)