Problem:
GCD and LCM

Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given a and b.

Input

Input consists of several data sets. Each data set contains a and b separated by a single space in a line. The input terminates with EOF.

Constraints

0 < a, b ≤ 2,000,000,000

LCM(a, b) ≤ 2,000,000,000

The number of data sets ≤ 50

Output

For each data set, print GCD and LCM separated by a single space in a line.

Sample Input

8 6
50000000 30000000

Output for the Sample Input

2 24
10000000 150000000

Solution in C (judge verdict: Memory Limit Exceeded)

#include<stdio.h>
#include<string.h>

char S[20000000],T[200000000],*x="ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?",q[10];
char *t[35]={"000001","10011010","0101","0001","110","01001","10011011","010000","0111","10011000",
"0110","00100","10011001","10011110","00101","111","10011111","1000","00110","00111","10011100",
"10011101","000010","10010010","10010011","10010000","101","000000","000011","10010001","010001","000001"};
int i,j,k,s[128],p;


int main()
{
	for(j=0;x[j];j++)s[x[j]]=k++;
	for(;gets(S);)
	{
		memset(T,0,sizeof(T));
		for(i=j=0;S[i];i++)
		{
			p=s[S[i]];
			for(k=4;k>=0;k--)
				T[j++]=(p>>k&1)+'0';
		}
		p=0;
		memset(q,0,sizeof(q));
		for(i=0;T[i];i++)
		{
			q[p++]=T[i];
			for(j=0;j<32;j++)
			{
				if(strcmp(q,t[j])==0)
				{
					putchar(x[j]);
					memset(q,0,sizeof(q));
					p=0;
				}
			}
		}
		puts("");
	}
	return 0;
}