結果

問題 No.587 七対子
ユーザー uafr_cs
提出日時 2017-11-03 22:25:16
言語 Java
(openjdk 23)
結果
AC  
実行時間 111 ms / 2,000 ms
コード長 723 bytes
コンパイル時間 1,943 ms
コンパイル使用メモリ 74,904 KB
実行使用メモリ 41,196 KB
最終ジャッジ日時 2024-07-19 19:39:03
合計ジャッジ時間 6,504 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Scanner;

public class Main {
	
	public static long MOD = 1000000007;
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		char[] alpha = new char[26];
		for(final char ch : sc.next().toCharArray()){
			alpha[ch - 'a']++;
		}
		
		int two_count = 0, one_count = 0;
		for(final int a : alpha){
			if(a == 2){ 
				two_count++;
			}else if(a == 1){
				one_count++;
			}
		}
		
		if(two_count == 6 && one_count == 1){
			for(int i = 0; i < 26; i++){
				if(alpha[i] == 1){
					System.out.println((char)(i + 'a'));
					return;
				}
			}
		}else{
			System.out.println("Impossible");
		}
	}
}
0