import static java.util.Arrays.deepToString;

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

public class competition_nn_slow {

	private static final String NO_SOLUTION = "No solution";

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

	static boolean correct(char[] c) {
		Stack<Integer> stack = new Stack<Integer>();
		for (char e : c) {
			int id = getID(e);
			if (id < 0) {
				if (stack.isEmpty() || stack.pop() != ~id) {
					return false;
				}
			} else {
				stack.add(id);
			}
		}
		return stack.isEmpty();
	}

	static final char[] ALPHABET = "{}()[]".toCharArray();

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

	static String solveStupid(char[] c) {
		for (int i = 0; i < c.length; i++) {
			char old = c[i];
			for (char d : ALPHABET) {
				if (d == old) {
					continue;
				}
				c[i] = d;
				if (correct(c)) {
					return (new String(c));
				}
			}
			c[i] = old;
		}
		return null;
	}

	static BufferedReader br;
	static StringTokenizer st;
	static PrintWriter out;

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

	static int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	static String next() throws IOException {
		while (st == null || !st.hasMoreTokens()) {
			String line = br.readLine();
			if (line == null) {
				return null;
			}
			st = new StringTokenizer(line);
		}
		return st.nextToken();
	}

	static long nextLong() throws IOException {
		return Long.parseLong(next());
	}

	static double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

	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);
		}
	}
}