Created
December 21, 2016 17:41
-
-
Save Jack-Saleem/f9b6e9732c4638c02b92b3eb2b22b2ea to your computer and use it in GitHub Desktop.
codeforces 141A Amusing Joke program in java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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