How to filter the problem difficulty wise like only of type A
| # | User | Rating |
|---|---|---|
| 1 | Benq | 3676 |
| 2 | Kevin114514 | 3657 |
| 3 | jiangly | 3638 |
| 4 | turmax | 3442 |
| 5 | tourist | 3380 |
| 6 | Um_nik | 3353 |
| 7 | strapple | 3350 |
| 8 | squareOf105 | 3346 |
| 9 | heuristica | 3322 |
| 10 | maroonrk | 3310 |
| # | User | Contrib. |
|---|---|---|
| 1 | Qingyu | 158 |
| 2 | nik_exists | 151 |
| 3 | maspy | 150 |
| 4 | AmShZ | 144 |
| 4 | Um_nik | 144 |
| 6 | Errichto | 139 |
| 7 | adamant | 137 |
| 8 | BledDest | 135 |
| 9 | maroonrk | 133 |
| 10 | Proof_by_QED | 131 |
How to filter the problem difficulty wise like only of type A
from collections import defaultdict
import math
def solve(a):
if len(a)<=2:
return 0
result=float("inf")
for i in "0123456789":
for j in "0123456789":
first=i
second=j
f=True
s=False
ans=""
for elements in a:
if first==elements and f:
ans+=first
f=False
s=True
elif second==elements and s:
ans+=second
f=True
s=False
if first!=second and len(ans)%2==1:
ans=ans[:-1]
result=min(len(a)-len(ans),result)
return result
for _ in range(int(input())):
a=input()
print(solve(a))
| Name |
|---|


