1.

/*
 * Angewandte Mathematik, SS11
 * Problem: 10340 - All in All
 * Link:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=15&problem=1281&mosmsg
 *
 * @author Tran, Tuan Anh
 * @author Stefan Haas
 * @version 1.0, 5/1/2011
 *
 * Method : Ad-Hoc
 * Status : Accepted
 * Runtime: 0.224
 */
package allinall;


import java.io.*;
public class Main {

    public static void main(String[] args) throws IOException{
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String line;

        while((line = input.readLine()) != null){
            
            String [] tmp = line.split(" ");
            String s = tmp[0];
            String t = tmp[1];
            if(s.equals(t)){
                System.out.println("Yes");
            }else{
                int index = 0;
                int all = 0;
                boolean isEnd = false;
                for(int i = 0;i < s.length() && !isEnd;i++){
                    char c = s.charAt(i);
                    boolean goOut = false;
                    for(int j = index;j<t.length() && !goOut;j++){
                        if(c == t.charAt(j)){
                            all++;
                            goOut = true;
                        }
                        index++;
                    }
                    if(index == t.length()){
                        isEnd = true;
                    }
                }
                if(all == s.length()){
                     System.out.println("Yes");
                }else{
                     System.out.println("No");
                }
            }
        }
    }
}  

2.
/**
* Angewandte Mathematik, SS11
* Problem: 10340 All in all
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=23&page=show_problem&problem=2113
*
* @author Peter Weismann
* @author Pirmin Schneider
* @version 1.0, 05/03/2011
*
* Method : Ad-Hoc
* Status : Accepted
* Runtime: 0.288
*/
import java.util.Scanner;

public class Main {

public static void main(String[] args) {
Scanner input = new Scanner(System.in);
String s;
String t;

while (input.hasNext()) {
s = input.next();
t = input.next();
if (search(s,t))
System.out.println("Yes");
else
System.out.println("No");
}
}

// Sucht, ob a ein Substring von b ist und gibt true || false aus
public static boolean search (String s, String t) {
boolean notFound = false;
int j = 0;
int aLength = s.length();
int bLength = t.length();

// Abbruchkriterium (Wenn der gesuchte String laenger als der ist, in dem gesucht wird)
if (s.length() > t.length())
return false;

for (int i = 0; i < aLength; i++) {
while (j < bLength) {
if (s.charAt(i) == t.charAt(j)) {
j++;
break;
}
else {
if (j == t.length() - 1) {
// Abbruchkriterium (ersetzt das break fuer die // aeussere Schleife)
i = aLength;
notFound = true;
break;
}
j++;
}
}
}

if (notFound)
return false;
else
return true;
}


}


-------------------------------------------------------------------------------

1.


/**
* Angewandte Mathematik, SS09, IFB 2C
* ACM Problem: All in All (10340)
* @author Christian Mitterreiter
* @author Rolf Luigs
* @version 1.0, 05/19/2009
* Status : Accepted
* Runtime: 0.184
*/


import java.util.Scanner;

public class Main {


public static void main(String[] args) {

int l1,l2,find,i,j,len;
boolean found = false;

Scanner sc = new Scanner(System.in);

while(sc.hasNext()) {

String i1 = sc.next();
String i2 = sc.next();

l1 = i1.length();
l2 = i2.length();

if(l2>l1)
{
len=0;
find=-1;
for( i=0;i<l1;i++) //Durchläuft "Grundwort"
{
found = false;
for(j=find+1;j<l2;j++) //Duchläuft "Codewort"
{
if(i1.charAt(i)==i2.charAt(j)) //Übereinstimmung
{
find=j; //Stelle der letzten Übereinstimmung
len++; //Anzahl der Übereinstimmungen
found = true;
break;
}
}
if(!found) //wenigstens ein Zeichen stimmt nicht überein
{
System.out.printf("No\n");
break;
}
}
if(found) System.out.printf("Yes\n");
}
else if(l1==l2&& i1.compareTo(i2)==0) System.out.printf("Yes\n"); //Wörter stimmen überein
else System.out.printf("No\n"); //Codewort kürzer als "Grundwort"
}
}
}