import static java.util.Arrays.deepToString;

import java.io.*;
import java.util.StringTokenizer;

public class competition_nn {

	private static final String NO_SOLUTION = "No solution";
	private static final String REVBRACKETS = ")]}";
	private static final String BRACKETS = "([{";

	static char byID(int id) {
		if (id < ~2 || id > 2) {
			throw new AssertionError();
		}
		return id >= 0 ? BRACKETS.charAt(id) : REVBRACKETS.charAt(~id);
	}

	static int getID(char c) {
		int pos = BRACKETS.indexOf(c);
		if (pos < 0) {
			return ~(REVBRACKETS.indexOf(c));
		} else {
			return pos;
		}
	}

	static final int PRIME = 239;

	static void solve() throws Exception {
		String line = br.readLine();
		validate(line);
		char[] c = line.toCharArray();
		String answer = solve(c);
		out.println(answer == null ? NO_SOLUTION : answer);
	}

	static String solve(char[] c) {
		int n = c.length;
		if ((n & 1) == 1) {
			return null;
		}
		Node[] a = new Node[n + 1];
		Node[] b = new Node[n + 1];
		a[0] = new Node(null, 1, 0);
		for (int i = 1; i <= n; i++) {
			int id = getID(c[i - 1]);
			Node lastNode = a[i - 1];
			if (id < 0) {
				if (lastNode.prev != null && lastNode.last == ~id) {
					a[i] = lastNode.prev;
				} else {
					break;
				}
			} else {
				a[i] = new Node(lastNode, lastNode.hash * PRIME + id, id);
			}
		}
		b[n] = new Node(null, 1, 0);
		for (int i = n - 1; i >= 0; i--) {
			int id = ~getID(c[i]);
			Node lastNode = b[i + 1];
			if (id < 0) {
				if (lastNode.prev != null && lastNode.last == ~id) {
					b[i] = lastNode.prev;
				} else {
					break;
				}
			} else {
				b[i] = new Node(lastNode, lastNode.hash * PRIME + id, id);
			}
		}
		for (int i = 0; i < n; i++) {
			Node left = a[i];
			Node right = b[i + 1];
			if (left == null || right == null) {
				continue;
			}
			int currentCharacter = getID(c[i]);
			for (int newCharacter = ~2; newCharacter <= 2; newCharacter++) {
				if (newCharacter == currentCharacter) {
					continue;
				}
				if (newCharacter < 0) {
					if (left.prev == null || left.last != ~newCharacter) {
						continue;
					}
					if (left.prev.hash != right.hash) {
						continue;
					}
					c[i] = byID(newCharacter);
					return new String(c);
				} else {
					if (right.prev == null || right.last != newCharacter) {
						continue;
					}
					if (right.prev.hash != left.hash) {
						continue;
					}
					c[i] = byID(newCharacter);
					return new String(c);
				}
			}
		}
		return null;
	}

	static class Node {
		Node prev;
		long hash;
		int last;

		public Node(Node prev, long hash, int last) {
			this.prev = prev;
			this.hash = hash;
			this.last = last;
		}

	}

	static void validate(String line) {
		for (char c : line.toCharArray()) {
			if ("{}[]()".indexOf(c) < 0) {
				throw new AssertionError("invalid character in input file");
			}
		}
	}

	static BufferedReader br;
	static PrintWriter out;

	static void debug(Object... a) {
		System.err.println(deepToString(a));
	}

	public static void main(String[] args) {
		try {
			File file = new File("competition.in");
			InputStream input = System.in;
			OutputStream output = System.out;
			if (file.canRead()) {
				input = (new FileInputStream(file));
				output = (new PrintStream("competition.out"));
			}
			br = new BufferedReader(new InputStreamReader(input));
			out = new PrintWriter(output);
			solve();
			out.close();
			br.close();
		} catch (Throwable e) {
			e.printStackTrace();
			System.exit(1);
		}
	}
}