#include<iostream>
#include<string>
#include<cctype>
using namespace std;
bool isvalid(string s){
    for (char c:s){
        if(!isalpha(c)){
            
        }
    }
    return true;
};
int main(){
    string word1 , word2;
    cin>>word1>>word2;
    if(!isvalid(word1)||!isvalid(word2)){
        cout<<"Invalid input"
        return 0;
    }
    string result=" ";
    int i=0;
    while(i<word.length()|| i<word.length()){
        }
}