import java.io.*;

public class JC {

	public static final int SIZE = 1000;
	public static boolean [] commas = new boolean[SIZE];
	public static int lastComma, lastSize;

	public static void main(String args[])
	{
		int size;
		int [] a = new int[SIZE];
		boolean [] comma = new boolean[SIZE];
		char ch;

		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String line ="";
		while (true) {

			try {
				line = in.readLine();
				} catch (Exception e) {};
			size = line.length();
			for(int i=0; i<size; i++) {
				a[i] = line.charAt(i)-'0';
				comma[i] = false;
				commas[i] = false;
			}
			if (size == 1 && a[0] == 0)
				break;
			lastComma = 0;
			lastSize = size;
			int i=1;
			while (i<size) {
				findseries(i, a, size, 0, comma);
				i++;
			}
			boolean nonzero = false;
			for(i=0; i<size; i++) {
				System.out.print(a[i]);
				if (a[i] != 0)
				nonzero = true;
				if (nonzero && commas[i]) {
					System.out.print(',');
					nonzero = false;
				}
			}
			System.out.println();

		}
	}

	public static boolean greater(int prev, int start, int end, int a[])
	{
		int prevend = start;
		while (start < end && a[start] == 0)
			start++;
		if (start == end && a[start] == 0)
			return false;
		while (prev < prevend-1 && a[prev] == 0)
			prev++;
		if (prev == prevend-1 && a[prev] == 0)
			return true;
		if (prevend-prev > end-start+1)
			return false;
		if (prevend-prev < end-start+1)
			return true;
		for(int i=start; i<=end; i++) {
			if (a[i] > a[i-start+prev])
				return true;
			else if (a[i] < a[i-start+prev])
				return false;
		}
		return false;
	}

	public static boolean greaterequal(int start1, int end1, int start2, int end2, int a[])
	{
		boolean iszero1 = false, iszero2 = false;
		while (start1 < end1-1 && a[start1] == 0)
			start1++;
		if (start1 == end1-1 && a[start1] == 0)
			iszero1 = true;
		while (start2 < end2-1 && a[start2] == 0)
			start2++;
		if (start2 == end2-1 && a[start2] == 0)
			iszero2 = true;
		if (end1-start1 > end2-start2)
			return true;
		if (end1-start1 < end2-start2)
			return true;
		for(int i=start1; i<end1; i++) {
			if (a[i] > a[i-start1+start2])
				return true;
			else if (a[i] < a[i-start1+start2])
				return false;
		}
		return true;
	}

	public static void findseries(int start, int[] a, int size, int prev, boolean [] comma)
	{
		if (start == size) {
			if (greaterequal(prev, size, lastComma, size, a)) {
				for(int i=0; i<size; i++)
					commas[i] = comma[i];
				lastComma = prev;
				int temp = prev;
				lastSize = size-prev;
			}
			return;
		}
		comma[start-1] = true;
		int i=start;
		while (i<size && !greater(prev, start, i, a)) {
			i++;
		}
		int j = start;
		while (j<i && a[j] == 0)
			j++;
		while (i<size && (i-j+1 <= lastSize)) {
			findseries(i+1, a, size, start, comma);
			i++;
		}
		comma[start-1] = false;
	}
}
