Smart Keypad-I Problem

In this problem, we have mapped array of strings, elements are mapped with its indices integers.

This is my code, it is working for the sample test case, but not for other test cases. kindly review and tell what is wrong with this code, or what is that I am missing in this question

My code

import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner scn=new Scanner(System.in);
int num=scn.nextInt();
int a=num/10;
int b=num%10;
String[] table={ " ", β€œ.+@$”, β€œabc”, β€œdef”, β€œghi”, β€œjkl” , β€œmno”, β€œpqrs” , β€œtuv”, β€œwxyz”};
String as=table[a];
String bs=table[b];
for(int i=0;i<as.length();i++)
{
for(int j=0;j<bs.length();j++)
{
System.out.print(as.charAt(i));
System.out.print(bs.charAt(j));
System.out.println();
}

	}
}

}

the input string can have size<=10
so for input like say 3816 you dont get the correct answer