import java.io.InputStream;

class ITE {

	private int next;

	private InputStream in;

	public class ParseError extends Exception {

		public String getMessage() {
			return "parse errror";
		}
	}

	public ITE(InputStream in) throws Exception {
		this.in = in;
		next = in.read();
	}

	private void eat(int symbol) throws Exception {
		if (next != symbol)
			throw new ParseError();
		next = in.read();
	}

	private void E() throws Exception {
		if(next < '0' || next > '9')
			throw new ParseError();
		eat(next);
		T();
	}

	private void T() throws Exception {
		if(next == ':' || next == '\n')
			return;
		if(next != '?')
			throw new ParseError();
		eat('?');
		E();
		eat(':');
		E();
	}

	public void parse() throws Exception {
		E();
		if (next != '\n')
			throw new ParseError();
	}

	public static void main(String[] args) {
		try {
			ITE parser = new ITE(System.in);
			parser.parse();
		} catch (Exception e) {
			System.err.println(e.getMessage());
		}
	}
}
