結果

問題 No.587 七対子
ユーザー tsuchinaga
提出日時 2019-02-27 09:54:15
言語 Go
(1.23.4)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 452 bytes
コンパイル時間 13,637 ms
コンパイル使用メモリ 223,628 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-19 19:58:20
合計ジャッジ時間 12,356 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import "fmt"

func main() {
	s := ""
	_, _ = fmt.Scan(&s)

	sets := make(map[string]int, 0)
	for _, c := range s {
		if _, ok := sets[string(c)]; ok {
			sets[string(c)]++
		} else {
			sets[string(c)] = 1
		}
	}

	c := ""
	num1 := 0
	for k, v := range sets {
		if v > 2 {
			fmt.Println("Impossible")
			return
		}
		if v == 1 {
			c = k
			num1++
			if num1 > 1 {
				fmt.Println("Impossible")
				return
			}
		}
	}

	fmt.Println(c)
}
0