Alice loves eating fruits.
Bob loves eating fruits.
Charlie loves eating fruits.
David loves eating fruits.
Ema loves eating fruits.
Franky loves eating fruits.
George loves eating fruits.
......
Xenia loves eating fruits.
Yeti loves eating fruits.
Zara loves eating fruits.
Everyone loves eating fruits.
"Enough!" Bob shouted angrily. Then he saw a string containing a lot of subsequences of different kinds of fruits. "Fruits fruits fruits! Why are you everywhere! I never want to see you again."
Alice held an apple in front of Bob, and Bob raged. He punishing her by asking her to count the number of different kinds of fruit that appeared as a subsequence in a long long long string.
But Alice didn't know what fruits are.
Bob said, "apple, banana, orange, mango, grape, kiwi, peach, lemon, lime, pear, plum, fig, date, guava, papaya, cherry, melon, berry, apricot, avocado, blackberry, blueberry, boysenberry, cranberry, elderberry, gooseberry, raspberry, strawberry, acai, ackee, aronia, breadfruit, cantaloupe, carambola, clementine, coconut, currant, dragonfruit, durian, feijoa, grapefruit, hackberry, honeydew, jackfruit, jambul, jujube, kumquat, loquat, lychee, mandarin, mulberry, nectarine, olive, passionfruit, persimmon, pineapple, plantain, pomegranate, pomelo, prune, quince, rambutan, salak, sapodilla, soursop, tamarind, tangerine, ugli, watermelon, yuzu, abiu, acerola, ambarella, babaco, bael, barbados, bilberry, biriba, blood, calamansi, camu, canistel, capulin, carissa, ceriman, chayote, cherimoya, citron, damson, dewberry, eggfruit, emblica, genip, genipa, guanabana, hog, icecream, imbe, jaboticaba, june, kabosu, kapok, kepel, key, korlan, langsat, lanzones, longan, lucuma, macadamia, mamey, mangosteen, marang, maypop, medlar, melon, miracle, monstera, morinda, muscadine, muskmelon, nance, nungu, oil, otaheite, pawpaw, pecan, pepino, phalsa, pitanga, pitaya, pitomba, pulasan, purple, quandong, raisin, red, rose, safou, santol, sapote, saw, service, soncoya, sorb, surinam, sweetsop, syzygium, tamarillo, thimble, tomatillo, ugni, velvet, wampee, white, wolfberry, yangmei, yellow, youngberry, zapote, zigzag, zucchini are fruits."
Alice went dizzy...... Please help her to calculate.
Note I: melon != melon, so melon and melon are distinct fruits. ($i.e.$ please count melon twice)
Note II: 50 ms time limit -> $O(|T|\times|S|)$ solution cannot pass. (use getline(cin,s)
for inputing the string)