ASME to SAME
Practice
3.2 (12 votes)
String
Basic programming
Implementation
Problem
83% Success 5498 Attempts 10 Points 2s Time Limit 256MB Memory 1024 KB Max Code

Problem

You are given 2 strings \(s\) and \(t\) both containing only lowercase English characters with s containing some \(?\) as well. You can swap characters at positions \(i\) and \(j\) in the string \(s\) (\(j\gt i\)) any number of times and can also replace any \(?\) with any lowercase English character. Can you convert \(s\) into \(t\) ?

Input Format

  • The first line contains an integer \(T\) denoting the number of test cases. 
  • The first line of each test case contains an integer \(N\), the length of the strings.
  • The second line of each test case contains \(N\) lowercase English characters with some \(?\)(possibly \(0\)) denoting string \(s\).
  • The third line of each test case contains \(N\) lowercase English characters denoting string \(t\).

Output Format

For each test case, print '\(Yes\)' (without quotation marks) if it is possible to convert \(s\) into \(t\).Otherwise, print '\(No\)' (without quotation marks). Print the output in a new line.

Constraints

\(1 \le T \le 10\)

\(1 \le N \le 10^5\)

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:10
82 votes
Tags:
Basic ProgrammingEasy
Points:10
82 votes
Tags:
Basic ProgrammingBasics of ImplementationImplementation
Points:10
258 votes
Tags:
Brute-force searchEasy