The below code is the complete code of Character Sequence of a given Number and the condition given that the limit is between 1-99 it does not exceeds the limit,if it does it takes the first two digit of the number
For example, if its 100=10 times it prints the respective character,This program is based on the array's positions,before you do,you have to consider it otherwise it spoil the entire code
import java.util.Scanner;
class CharSequence
{
static void PrintSeq(char c, int num)
{
while (num > 1)
{
System.out.print(c);
num--;
}
}
static void ToConvert(String str)
{
char c[] = str.toCharArray();
for (int i = 0; i < c.length; i++)
{
int val = 0;
if ( c[i] >= '0' && c[i] <= '9' )
{
try
{
if ( c[i + 1] >= '0' && c[i + 1] <= '9' )
{
String a1 = String.valueOf(c[i] - 48);
String a2 = String.valueOf(c[i + 1] - 48);
val = Integer.parseInt(a1 + a2);
PrintSeq(c[i - 1], val);
i++;
}
else
{
val = c[i] - 48;
PrintSeq(c[i - 1], val);
}
}
catch (ArrayIndexOutOfBoundsException ex)
{
val = c[i] - 48;
PrintSeq(c[i - 1], val);
}
}
else
{
System.out.print(c[i]);
}
}
}
public static void main(String args[]) throws Exception
{
Scanner s=new Scanner(System.in);
String wrd=s.nextLine();
ToConvert(wrd);
}
}