Find number of substrings with same first and last characters


This is a companion discussion topic for the original entry at http://iq.opengenus.org/substrings-with-same-first-and-last-character/