The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 398 Weeks Ago, 1 Day Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
Â
Shil likes to play with Palindromes very much.So he created his own version of Palindrome Game. In this game , he will be given
a string S and he needs to find out total number of pairs ( A , B ) such that A and B both are Palindromes present in S and B is a proper suffix of A.
Since string S contains a large number of Palindromes he asks for your help.Note that two Palindromes are considered different if they occurs at different position in string S
Only line of input contains string S
Print a single integer denoting total number of pairs (A,B) . Since answer can be large print it modulus 109+7
String S will contain atmost 105 lower case english alphabets ('a' to 'z').
Â
All the possible palindromes are [ aa , a , a , bb , b ,b ].So all possible pairs are ( aa , a ) , ( aa , a ) , ( bb , b ) , ( bb , b )
Note that two Palindromes are considered different if they occur at different positions in the string S
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll