CPU: 1s
Memory: 1024MB
দুইটি স্ট্রিং S1 এবং S2 দেওয়া আছে। তোমাকে নির্ণয় করতে হবে স্ট্রিং দুইটি জোড়া স্ট্রিং কিনা। দুইটি স্ট্রিং জোড়া স্ট্রিং হবে যদি কোন একটি ক্যারেক্টার ম্যাপিং এর মাধ্যমে এদের একটিকে অপরটিতে পরিবর্তন করা যায়। একটি ক্যারেক্টার ম্যাপিং বৈধ হবে যদি তা নিম্নোক্ত নিয়মাবলি মেনে চলেঃ
একটি ক্যারেক্টারকে কে নিজের উপরে ম্যাপ করা যাবে অথবা কেবলমাত্র অপর একটি ক্যারেক্টারে ম্যাপ করা যাবে।
দুইটি ক্যারেক্টার কখনই একই ক্যারেক্টারে ম্যাপ হবে না।
উদাহরণস্বরূপঃ
“book” এবং “meet” জোড়া স্ট্রিং। যেই ক্যারেক্টার ম্যাপিংটি ব্যবহার করা হয়েছে তা হল b = m, o = e, k = t.
“cola” এবং “cold” জোড়া স্ট্রিং। ম্যাপিং টি হল c = c, o = o, l = l, a = d.
“book” এবং “goat” জোড়া স্ট্রিং নয়। কারণ কোন যথাযথ ম্যাপিং সম্ভব নয়।
Given two strings s1 and s2, determine if they are twins. Two strings are twins if one string can be transformed to the other using some sort of character mapping. A character mapping is valid if it abides by the following rules:
A character is mapped to either itself or to exactly one other character.
No two characters map to the same character.
For example:
“book”, “meet” are Twins. The mapping used to transform the former to the latter is: b = m, o = e, k = t.
“cola”, “cold” are Twins. Replacement mapping is c = c, o = o, l = l, a = d. “book”, “goat” are not Twin. No Valid character mapping exists for the transformation.
ইনপুটের বর্ণনা
ইনপুটের প্রথম লাইনে টেস্টকেসের সংখ্যা T দেওয়া থাকবে। পরবর্তী T টি লাইনের প্রত্যেকটিতে স্পেস দিয়ে আলাদা করা দুইটি স্ট্রিং s1 এবং s2 দেওয়া থাকবে। দুইটি স্ট্রিং এর দৈর্ঘ্য সমান হবে এবং স্ট্রিং দুইটি শুধুমাত্র ছোটহাতের অক্ষর দিয়ে তৈরী হবে।
Input
The first line of the input gives the number of test cases, T . Each of following lines will consist of two space separated strings s1 and s2. Both strings will be of same length and will consist only of lowercase letters.
অাউটপুটের বর্ণনা
প্রতিটি টেস্টকেসের জন্য একটি লাইন আউটপুট দিতে হবে। “yes” প্রিন্ট করতে হবে যদি স্ট্রিং দুইটি জোড়া স্ট্রিং হয়, অন্যথায় “no” প্রিন্ট করতে হবে।
Output
For each test case output a single line. Print “yes” if the input strings are twins, else print “no”.
Limit
1<=T<=20.
|s1|=|s2|<=10000
(এখানে |S| দ্বারা S স্ট্রিং এর দৈর্ঘ্য বুঝানো হয়েছে।)
(Here |S| represents the length of string S.)
Sample
Input | Output |
---|---|
3 book meet cola cold book goat | yes yes no |