import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner s=new Scanner(System.in);
String str=s.nextLine();
String pattern=s.nextLine();
char patt_temp[] = pattern.toCharArray();
Arrays.sort(patt_temp);
String patt=new String(patt_temp);
HashMap<Character,Integer> map=new HashMap<>();
int left=0;
int right=0;
int count=0;int k=0;int ans_left=0;int ans_right=0;
while(left<str.length() || right<str.length()){
while(right<str.length() && k<patt.length() && count<patt.length()){
if(str.charAt(right)==patt.charAt(k)){
count++;right++;k++;
}else {
if(map.containsKey(str.charAt(right))){
map.put(str.charAt(right),map.get(str.charAt(right))+1);
}else{
map.put(str.charAt(right),1);
}
while(k<patt.length() && map.containsKey(patt.charAt(k))) {
count++;k++;
}
right++;
}
}
if(count!=patt.length()){
System.out.println("No string");
return;
}
int min=0;
int ans=Integer.MAX_VALUE;
if(freq(str.charAt(left),patt)==map.get(str.charAt(left))){
min=right-left+1;
if(min<ans){
ans=min;
ans_left=left;
ans_right=right;
}
left=right;
count=0;
continue;
}else if(freq(str.charAt(left),patt)<map.get(str.charAt(left))){
while(freq(str.charAt(left),patt)<map.get(str.charAt(left))){
left++;
}
right=left;
count=0;
continue;
}
}
String g=str.substring(ans_left,ans_right+1);
System.out.println(g);
}
public static int freq(char ch,String array){
int n=array.indexOf(ch);
int count=0;
while(array.charAt(n)==ch){
count++;
n++;
}
if(count!=0)
return count;
return -1;
}
}