Play with strings
All submissions for this problem are available.
Gennady likes strings very much. He likes to solve most problems involving strings. So this problem contains strings and strings only.
You will be given a string S with lower-case alphabets only. You have to count the number of substrings which start and end at the same character and has an odd length.
First line contains a positive integer T denoting the number of test cases.
For each test case, a string S is provided without any spaces in a separate new line.
For every T test cases, find the required answer.
Substring wiki: link.
1 ≤ T ≤ 5
1 ≤ |S| ≤ 10^6
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, SCM chicken, CLOJ, FS|
Fetching successful submissions