ProblemsAll Submissions


You are given a secret string X and you are also given the password to Ninja's laptop which is Y.
Can you make Y by rearranging X?

Input
An integer t(<=500) denoting the number of test cases
Two different strings X & Y for ith test case on separate line(1<=length(X,Y)<=20

Output
For every test case print "YES" if you can form Y from X or "NO" otherwise.

Sample Input
2
aba aab
bcc bcd

Sample Output
YES
NO









Languages: AWK,Bash,Brain,C,C++,Java,C#,JavaScript,Pascal,Perl,PHP,Python,Python3,Ruby,Text

Time Limit: 1 Second(s)
Score: 100 Point(s)
Input File Limit: 50000 Bytes

Submit

Login to post clarification.

aditya:
Q. gprathour


aditya:
Q. yes


Anonymous:
Q. yes


amit003:
Q. Q:yes


dhruwalkushwaha:
Q. import java.util.Scanner; class ScannerTest{ public static void main(String args[]){ Scanner sc=new Scanner(System.in); System.out.println("Enter your number of test cases"); int test=sc.nextInt(); System.out.println("Enter your string 1"); Scanner scanner = new Scanner(System.in); String str1 = scanner.nextLine(); System.out.println("Your username is " + str1); System.out.println("Enter your string 2: "); Scanner scanner = new Scanner(System.in); String str2 = scanner.nextLine(); System.out.println("Your username is " + str2); if(str1==str2) System.out.println("YES"); else System.out.println("NO"); } }


gagan:
Q. num= int(raw_input("enter the number")) a=[] for i in range(num): x= raw_input("enter the x") y = raw_input("enter the y") x = "".join(sorted(x)) y = "".join(sorted(y)) if x==y: a.append("matched") else: a.append("not matched") print a[0]+"\n"+ a[1]


abhinav@insta:
Q. #include<stdio.h> void main( ) int t; string a,b; printf("enter no. of input="); scanf("%d",&t) for(i=0;i<=t;i++) { printf("enter string"); scanf("%c",&a); printf("enter ninja laptop"); scanf(%c",&b);


sujeet_1610169:
Q. #include<stdio.h> #include<stdlib.h> #include<string.h> void main() { char X[50],Y[50]; int i; printf("enter x and y"); gets(X); gets(Y); if((strlen(X)==strlen(Y)) //if() printf("YES"); else printf("NO"); }


AJCSE:
Q. #include<stdio.h> #include<stdlib.h> #include<string.h> void main() { int i, j, t, a[500]; printf("enter no. of test cases"); scanf("%d",&t); for(i=0;i<=t;i++) }


dhruwalkushwaha:
Q. import java.util.Scanner; class ScannerTest{ public static void main(String args[]){ Scanner sc=new Scanner(System.in); System.out.println("Enter your number of test cases"); int test=sc.nextInt(); System.out.println("Enter your string 1"); Scanner scanner = new Scanner(System.in); String str1 = scanner.nextLine(); System.out.println("Your username is " + str1); System.out.println("Enter your string 2: "); Scanner scanner = new Scanner(System.in); String str2 = scanner.nextLine(); System.out.println("Your username is " + str2); if(str1==str2) System.out.println("YES"); else System.out.println("NO"); } }


sujeet_1610169:
Q. #include<stdio.h> #include<stdlib.h> #include<string.h> void main() { char X[50],Y[50]; int i; printf("enter x and y"); gets(X); gets(Y); if((strlen(X)==strlen(Y)) //if() printf("YES"); else printf("NO"); }


satyamsangal:
Q. import java.util.Scanner; class ScannerTest{ public static void main(String args[]){ Scanner sc=new Scanner(System.in); System.out.println("Enter your number of test cases"); int test=sc.nextInt(); System.out.println("Enter your string 1"); Scanner scanner = new Scanner(System.in); String str1 = scanner.nextLine(); System.out.println("Your username is " + str1); System.out.println("Enter your string 2: "); Scanner scanner = new Scanner(System.in); String str2 = scanner.nextLine(); System.out.println("Your username is " + str2); if(str1==str2) System.out.println("YES"); else System.out.println("NO"); } }

Contest

Mode Judge

Passive

Online

Overall Rankings