結果

問題 No.587 七対子
ユーザー horiesiniti
提出日時 2018-03-12 08:07:02
言語 Ruby
(3.4.1)
結果
AC  
実行時間 94 ms / 2,000 ms
コード長 256 bytes
コンパイル時間 44 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 12,288 KB
最終ジャッジ日時 2024-07-19 19:51:22
合計ジャッジ時間 4,282 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

s=gets.chomp
s=s.split("").sort
c=0
t=s[0]
ans=""
s.each{|e|
	if e==t
		c+=1
	else
		if (c==1)
			ans+=t
		elsif c>2
			ans+="  "
		end
		
		c=1
		t=e
	end
}
if (c==1)
	ans+=t
elsif c>2
	ans+="  "
end

if ans.length==1
	puts ans
else
	puts "Impossible"
end
0