Language: C

#define M 100
char m[M][M],s[M][M][M],r[M],*z;
cmp(char *p,char *q){
  int r=0;
  for(;*p=='0';p++);
  for(;*q=='0';q++);
  if(r=strlen(p)-strlen(q))return r;
  return strcmp(p,q);
}
main(w,h,i,j,k,l){
	for(;scanf("%d%d",&w,&h),w;puts(z)){
		memset(m,0xff,sizeof(m));
		memset(s,0,sizeof(s));
		memset(r,0,sizeof(r));
		for(j=1;j<=h;j++)scanf("%s",m[j]+1);
		for(i=1;i<=w+1;i++)for(j=1;j<=h;j++)if(m[j][i]<'0'||'9'<m[j][i])m[j][i]=-1;
		//for(k=1;k<M;k++){
		for(i=1;i<=w;i++)
			//for(j=i=k;i<=w;i++){
			for(j=1;j<=h;j++){
				if(m[j][i]==-1)continue;
				if(cmp(s[j][i-1],s[j-1][i])>0)strcpy(s[j][i],s[j][i-1]),s[j][i][strlen(s[j][i])]=m[j][i];
				else strcpy(s[j][i],s[j-1][i]),s[j][i][strlen(s[j][i])]=m[j][i];
				if(cmp(s[j][i],r)>0)strcpy(r,s[j][i]);
    		}
/*
			for(j=i=k;j<=h;j++){
				if(m[j][i]==-1)continue;
				if(cmp(s[j][i-1],s[j-1][i])>0)strcpy(s[j][i],s[j][i-1]),s[j][i][strlen(s[j][i])]=m[j][i];
				else strcpy(s[j][i],s[j-1][i]),s[j][i][strlen(s[j][i])]=m[j][i];
				if(cmp(s[j][i],r)>0)strcpy(r,s[j][i]);
			}
*/
		}
		for(z=r;*z=='0';z++);
	}
return 0;}

Compiler output:
main.c:3:1: error: return type defaults to 'int' [-Wimplicit-int]
    3 | cmp(char *p,char *q){
      | ^~~
main.c: In function 'cmp':
main.c:7:8: error: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
    7 |   if(r=strlen(p)-strlen(q))return r;
      |        ^~~~~~
main.c:1:1: note: include '<string.h>' or provide a declaration of 'strlen'
  +++ |+#include <string.h>
    1 | #define M 100
main.c:7:8: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch]
    7 |   if(r=strlen(p)-strlen(q))return r;
      |        ^~~~~~
main.c:7:8: note: include '<string.h>' or provide a declaration of 'strlen'
main.c:8:10: error: implicit declaration of function 'strcmp' [-Wimplicit-function-declaration]
    8 |   return strcmp(p,q);
      |          ^~~~~~
main.c:8:10: note: include '<string.h>' or provide a declaration of 'strcmp'
main.c: At top level:
main.c:10:1: error: return type defaults to 'int' [-Wimplicit-int]
   10 | main(w,h,i,j,k,l){
      | ^~~~
main.c: In function 'main':
main.c:10:1: error: type of 'w' defaults to 'int' [-Wimplicit-int]
main.c:10:1: error: type of 'h' defaults to 'int' [-Wimplicit-int]
main.c:10:1: error: type of 'i' defaults to 'int' [-Wimplicit-int]
main.c:10:1: error: type of 'j' defaults to 'int' [-Wimplicit-int]
main.c:10:1: error: type of 'k' defaults to 'int' [-Wimplicit-int]
main.c:10:1: error: type of 'l' defaults to 'int' [-Wimplicit-int]
main.c:11:14: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   11 |         for(;scanf("%d%d",&w,&h),w;puts(z)){
      |              ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | #define M 100
main.c:11:14: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   11 |         for(;scanf("%d%d",&w,&h),w;puts(z)){
      |              ^~~~~
main.c:11:14: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:11:36: error: implicit declaration of function 'puts' [-Wimplicit-function-declaration]
   11 |         for(;scanf("%d%d",&w,&h),w;puts(z)){
      |                                    ^~~~
main.c:11:36: note: include '<stdio.h>' or provide a declaration of 'puts'
main.c:12:17: error: implicit declaration of function 'memset' [-Wimplicit-function-declaration]
   12 |                 memset(m,0xff,sizeof(m));
      |                 ^~~~~~
main.c:12:17: note: include '<string.h>' or provide a declaration of 'memset'
main.c:12:17: warning: incompatible implicit declaration of built-in function 'memset' [-Wbuiltin-declaration-mismatch]
main.c:12:17: note: include '<string.h>' or provide a declaration of 'memset'
main.c:22:63: error: implicit declaration of function 'strcpy' [-Wimplicit-function-declaration]
   22 |                                 if(cmp(s[j][i-1],s[j-1][i])>0)strcpy(s[j][i],s[j][i-1]),s[j][i][strlen(s[j][i])]=m[j][i];
      |                                                               ^~~~~~
main.c:22:63: note: include '<string.h>' or provide a declaration of 'strcpy'
main.c:22:63: warning: incompatible implicit declaration of built-in function 'strcpy' [-Wbuiltin-declaration-mismatch]
main.c:22:63: note: include '<string.h>' or provide a declaration of 'strcpy'
main.c:22:97: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch]
   22 |                                 if(cmp(s[j][i-1],s[j-1][i])>0)strcpy(s[j][i],s[j][i-1]),s[j][i][strlen(s[j][i])]=m[j][i];
      |                                                                                                 ^~~~~~
main.c:22:97: note: include '<string.h>' or provide a declaration of 'strlen'
main.c:23:38: warning: incompatible implicit declaration of built-in function 'strcpy' [-Wbuiltin-declaration-mismatch]
   23 |                                 else strcpy(s[j][i],s[j-1][i]),s[j][i][strlen(s[j][i])]=m[j][i];
      |                                      ^~~~~~
main.c:23:38: note: include '<string.h>' or provide a declaration of 'strcpy'
main.c:23:72: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch]
   23 |                                 else strcpy(s[j][i],s[j-1][i]),s[j][i][strlen(s[j][i])]=m[j][i];
      |                                                                        ^~~~~~
main.c:23:72: note: include '<string.h>' or provide a declaration of 'strlen'
main.c:24:53: warning: incompatible implicit declaration of built-in function 'strcpy' [-Wbuiltin-declaration-mismatch]
   24 |                                 if(cmp(s[j][i],r)>0)strcpy(r,s[j][i]);
      |                                                     ^~~~~~
main.c:24:53: note: include '<string.h>' or provide a declaration of 'strcpy'
main.c: At top level:
main.c:37:1: error: expected identifier or '(' before 'return'
   37 | return 0;}
      | ^~~~~~
main.c:37:10: error: expected identifier or '(' before '}' token
   37 | return 0;}
      |          ^