In an effort to find something to do during self-quarantine,your friend flips a coin many times and carefully records theresult of each flip in a character vector using either H or T.Write a function named greatestRun that receives this characterarray and then analyzes it to find the largest number ofconsecutive heads or tails. It must return two values: (1) thenumber corresponding to how many heads or tails were thrown in arow and (2) the character H or T depending upon whether it wasHeads or Tails that was thrown the most times. In the event of atie for the longest run, return the character B for both
Please solve the Heads-or-Tails problem in C or C++ using eitherWindows or Linux. Read the H-or-T data from
a below file or from STDIN. Report the result and relatedstatistics to STDOUT. Report any errors to
STDERR:
File: HTHHTTTHHTHHHTHTHTHHHHHTTHHHHHHHHHHHHTTTTTTTTTH