Company: Visa__...
Difficulty: easy
Count Triplets of Consecutive Characters You are part of a software development team building a text analysis tool. One requested feature is to spot triplets of consecutive characters whose two outer characters are the same letter. You are given a string text made of English letters. A triplet is any block of three consecutive characters of text , that is text[i] , text[i+1] , text[i+2] for some position i . A triplet qualifies when its first and last characters are the same letter, ignoring case — so aXa , AbA , zZz and aBA all qualify. Count the qualifying triplets. Triplets are counted by position , so triplets that overlap are all counted, and two triplets that happen to spell the same three characters at different positions count twice. Input Format A single line containing the string text . The string may be empty, in which case the line is empty. Output Format Print a single integer — the number of qualifying triplets. Constraints text consists of English letters only, both uppe