#include<bits/stdc++.h>
#include <cstring>
using namespace std;
int main(){
    string s,t;
    cin>>s;
    cin>>t;
    unordered_map<char,int> w;
    unordered_map<char,int> p;
    int o=0;
    for(char c:s){
        w[c]++;
    }
    for(char c:t){
        p[c]++;
    }
    for(char c:s){
        if(w[c]>0&&p[c]>0) o++;
    }
    if(o==s.length()) cout<<"true"<<endl;
    else cout<<"false"<<endl;
}