Skip to content

Instantly share code, notes, and snippets.

@Jack-Saleem
Created December 21, 2016 17:41
Show Gist options
  • Save Jack-Saleem/f9b6e9732c4638c02b92b3eb2b22b2ea to your computer and use it in GitHub Desktop.
Save Jack-Saleem/f9b6e9732c4638c02b92b3eb2b22b2ea to your computer and use it in GitHub Desktop.
codeforces 141A Amusing Joke program in java
import java.util.Scanner;
public class AmusingJoke
{
public static void main(String[] args)
{
Scanner z = new Scanner(System.in);
String s = z.nextLine().toLowerCase();
String n = z.nextLine().toLowerCase();
String p = z.nextLine().toLowerCase();
String sn = s+n;
if(sn.length() == p.length()){
boolean flag = false;
for(char aa='a';aa<='z';aa++){
if(sn.contains(String.valueOf(aa))){
sn = sn.replaceAll(String.valueOf(aa), "");
int x = sn.length();
p = p.replaceAll(String.valueOf(aa), "");
int y = p.length();
if(x != y){
flag = true;
break;
}
}
}
if(!flag)
System.out.println("YES");
else
System.out.println("NO");
}else{
System.out.println("NO");
}
z.close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment