Tragic Lands

4

47 votes
Easy-Medium
Problem

Tragedy is the new cool. Vanshika is in love with lands and with tragedy. A tragic land is a continuous piece of land.

You are given a string land s. Print the number of unique tragic lands.

Input

First line contains t, number of test cases<=10

Following t lines contain a string of length<=1000

Output

Number of unique tragic lands for each test case in unique line

Setter : Akshay Miterani

Tester : Tanmay Patel

Time Limit: 3
Memory Limit: 256
Source Limit:
Explanation

aaac ==> a, c , aa, ac, aaa, aac, aaac

Hence ans=7

Editor Image

?