language: Lua (luac 5.1.4)
date: 104 days 22 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
local read, write = io.read, io.write
local num, nl = '*n', '\n'
local t
 
t = read(num)
 
while t > 0 do
        t = t-1
        local str
        str = read(num)
        
        
        local l = string.len(str)
        local i,count = 0,0
        while i < l do
                local j = 0
                while j < l do
                        if string.byte(str,i+1) == string.byte(str,j+1) then 
                                count = count+1 
                        end
                                
 
                        
                j = j + 1
                end
                i = i + 1
        end
        write(count)
        write("\n")
end