1.

import java.io.*;
import java.util.*;

/**
* ACM Training 2009
* ACM Problem #11660 - Look-and-Say sequences
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=78&page=show_problem&problem=2707
*
* @author Felix Dietrich
* @version 1.0, 09/26/2009
*
* Methode: DP
* Status : Accepted
* Runtime: 0.160
*/

public class Main
{
static int[] digits = new int[1005];
static int[] workdigits = new int[1005];
static int currentWorkIndex = 0;

public static void main(String... args) throws NumberFormatException, IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st;
String x;
int i, j;

while (true)
{
st = new StringTokenizer(br.readLine());

/////////////
// READ INFO
x = st.nextToken();
i = Integer.parseInt(st.nextToken());
j = Integer.parseInt(st.nextToken());

if (x.equals("0") && i == 0 && j == 0)
return;

for(int k=0; k<x.length(); k++)
digits[k] = Integer.parseInt(Character.toString(x.charAt(k)));
digits[x.length()] = 'x';

/////////////
// CALC
// perform i transformations
for(;i>1;i--)
{
transform(digits);
}

System.out.println(digits[j-1]);
}
}

/**
* Transforms digits2 one step further in the sequence.
* 11 -> 21, 21 -> 1211 and so on.
* Maximum length of the sequence is 1000, there will be no calculations beyond this index.
*
* @param digits2
*/
private static void transform(int[] digits2)
{
currentWorkIndex = 0;
int counter = 0;
int lastChar = digits2[0];

for(int i=0; i<digits2.length; i++)
{
if(digits2[i] == 'x' || currentWorkIndex > 1000 )
break;

if(lastChar == digits2[i])
counter++;
else
{
appendChars(workdigits, counter, lastChar);
lastChar = digits2[i];
counter = 1;
}
}
appendChars(workdigits, counter, lastChar);
workdigits[currentWorkIndex] = 'x';

for(int i=0; i<digits2.length; i++)
{
digits2[i] = workdigits[i];
if(workdigits[i] == 'x')
return;
}
}

/**
* Appends the counter and the character lastChar to the current workdigits.
* @param workdigits2
* @param counter
* @param lastChar
*/
private static void appendChars(int[] workdigits2, int counter, int lastChar)
{
workdigits2[currentWorkIndex] = counter;
workdigits2[currentWorkIndex+1] = lastChar;
currentWorkIndex += 2;
}
}

2.

import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
* ACM Training 2009
* ACM Problem #11660 - Look-and-Say sequences
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=78&page=show_problem&problem=2707
*
* @author Dennis Wilfert
* @version 1.0, 09/06/2009
*
* Status : Accepted
* Runtime: 0.412
*/
public class Look {


public static void main(String[] args) throws IOException {

BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
PrintWriter writer = new PrintWriter(new BufferedOutputStream(System.out));

StringTokenizer token = new StringTokenizer(reader.readLine());
String num = token.nextToken();
int[] x = new int[1010];
int[] newx;
int last = num.length()+2;
int a, b;
for(a = 0; a < last-2; a++){
x[a] = Integer.parseInt(num.substring(a, a+1));
}

int i = Integer.parseInt(token.nextToken())-1;
int j = Integer.parseInt(token.nextToken());

int count, tmp, tmppos;
while(j != 0){

for(a = 0; a < i; a++){

tmp = x[0];
count = 1;
tmppos = 0;
newx = new int[4010];
for(b = 1; b < last; b++){
if(x[b] != tmp){
newx[tmppos] = count;
newx[tmppos+1] = tmp;
count = 1;
tmppos += 2;
tmp = x[b];
}
else{
count++;
}
}
last = tmppos < j ? tmppos+2 : j*2+6;
x = newx;

}

writer.println(x[j-1]);


token = new StringTokenizer(reader.readLine());
num = token.nextToken();
last = num.length()+2;
x = new int[1010];
for(a = 0; a < last-2; a++){
x[a] = Integer.parseInt(num.substring(a, a+1));
}

i = Integer.parseInt(token.nextToken())-1;
j = Integer.parseInt(token.nextToken());

}
writer.flush();
}
}