結果

問題 No.2419 MMA文字列2
ユーザー ああいい
提出日時 2023-08-12 18:59:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 192 ms / 2,000 ms
コード長 182 bytes
コンパイル時間 181 ms
コンパイル使用メモリ 82,508 KB
実行使用メモリ 76,744 KB
最終ジャッジ日時 2024-11-20 09:21:50
合計ジャッジ時間 3,640 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

S = input()
from collections import defaultdict

d = defaultdict(int)
ans = 0
for s in S:
	for u in d:
		if u == s:continue
		v = d[u]
		ans += v * (v - 1) // 2
	d[s] += 1
print(ans)
0