Skip to content

Instantly share code, notes, and snippets.

@mehtaparitosh
Created August 31, 2017 15:01
Show Gist options
  • Save mehtaparitosh/fdf3ded2342398ca44a83f59513c959c to your computer and use it in GitHub Desktop.
Save mehtaparitosh/fdf3ded2342398ca44a83f59513c959c to your computer and use it in GitHub Desktop.
package project;
import java.util.*;
import java.io.*;
/**
*
* @author Paritosh Mehta
*/
public class Payoda {
public static boolean checker(char[] x, char[] y){
int i, j=0, flag=0;
for(i=0; i<x.length; i++){
for(; j<y.length; j++){
if(x[i]==y[j]){
flag++;
break;
}
}
}
if (flag == x.length)
return true;
else
return false;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String temp = sc.nextLine();
char[] S1 = temp.toCharArray();
temp = sc.nextLine();
char[] S2 = temp.toCharArray();
temp = sc.nextLine();
char[] S3 = temp.toCharArray();
if(checker(S1,S3)&&checker(S2,S3))
System.out.println("YES");
else
System.out.println("NO");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment