Time Exceeded
Code
t=int(input())
for x in range(t):
n=int(input())
s=input()
li=list(s)
se=list(set(s))
pair=0
for i in se:
count=0
for j in li:
if i ==j:
count+=1
pair+=(count*(count-1))
print(pair)
Information
- Submit By
- Type
- Submission
- Problem
- P1038 Do not touch my string
- Contest
- Brain Booster #3
- Language
- Python 3 (Python 3.12.3)
- Submit At
- 2024-05-06 16:48:19
- Judged At
- 2024-11-11 03:32:46
- Judged By
- Score
- 40
- Total Time
- ≥2059ms
- Peak Memory
- ≥11.84 MiB