Language: Java

import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.Collectors;

/**
 * @see <a href='http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?lang=jp&id='>??????</a>
 */
public class Main {
	private static Scanner in = new Scanner();
	private static final String STABLE = "Stable";
	private static final String NOT_STABLE = "Not stable";

	public static void main(String[] args) throws Exception {
		Main main = new Main();
		main.run();
	}

	private void run() {
		int n = in.nextInt();
		String[] vals = in.nextLine().split(" ");

		String[] bubble = bubbleSort(vals);
		String[] selection = selectionSort(vals);
		Arrays.sort(vals);

		printResult(bubble, vals);
		printResult(selection, vals);
	}

	private void printResult(String[] sorted, String[] stable) {
		Arrays.stream(sorted).collect(Collectors.joining(" "));
		System.out.println(Arrays.equals(sorted, stable) ? STABLE : NOT_STABLE);
	}

	private String[] bubbleSort(String[] vals) {
		String[] sorted = Arrays.stream(vals).collect(Collectors.toList()).toArray(new String[]{});
		for (int i = 0; i < sorted.length; i++) {
			for (int j = sorted.length - 1; j > i; j--) {
				if (vals[j].charAt(1) < vals[j - 1].charAt(1)) {
					swap(j, j - 1, vals);
				}
			}
		}
		return sorted;
	}

	private String[] selectionSort(String[] vals) {
		String[] sorted = Arrays.stream(vals).collect(Collectors.toList()).toArray(new String[]{});
		return sorted;
	}

	private void swap(int i, int j, String[] vals) {
		String temp = vals[i];
		vals[i] = vals[j];
		vals[j] = temp;
	}
}

Compiler output:
Main.java:9: error: no suitable constructor found for Scanner(no arguments)
	private static Scanner in = new Scanner();
	                            ^
    constructor Scanner.Scanner(Readable,Pattern) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(Readable) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(InputStream) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(InputStream,String) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(InputStream,Charset) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(File) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(File,String) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(File,Charset) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(File,CharsetDecoder) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(Path) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(Path,String) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(Path,Charset) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(String) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(ReadableByteChannel) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(ReadableByteChannel,String) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(ReadableByteChannel,Charset) is not applicable
      (actual and formal argument lists differ in length)
1 error