Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package project_of_me;
- import java.util.Scanner;
- public class bai_easy
- {
- public static void main(String[] args)
- {
- //System.setIn(new FileInputStream("D:\\data\\bai2.txt"));
- Scanner sc = new Scanner(System.in);
- int test_case = sc.nextInt();
- for(int tc = 0; tc < test_case; tc++)
- {
- String str1 = new String();
- str1 = sc.next();
- char [] arr1 = new char[str1.length()];
- String str2 = new String();
- str2 = sc.next();
- char [] arr2 = new char[str2.length()];
- if(str1.length() != str2.length())
- {
- System.out.println("(s1,s2) = "+ false);
- }
- else
- {
- for(int i = 0; i < str1.length(); i++)
- {
- arr1[i] = str1.charAt(i);
- arr2[i] = str2.charAt(i);
- }
- int count = 0;
- for(int i = 0; i < arr1.length; i++)
- {
- for(int j = 0; j < arr1.length; j++)
- {
- if(arr1[i] == arr2[j])
- {
- count++;
- arr1[i] = arr2[j] = ' ';
- break;
- }
- else
- {
- if(arr1[i] == '?')
- {
- count++;
- arr1[i] = ' ';
- }
- if(arr2[j] == '?')
- {
- count++;
- arr2[j] = ' ';
- }
- }
- }
- }
- if(count < arr1.length)
- System.out.println("#"+(tc+1)+" (s1,s2) " + false);
- else
- System.out.println("#"+(tc+1)+"(s1,s2) " + true);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement