#C9737. Single Character Transformation
Single Character Transformation
Single Character Transformation
Given two strings \(S\) and \(T\) of equal length, determine whether it is possible to transform \(S\) into \(T\) by changing exactly one character.
In other words, there should be exactly one index \(i\) (using 1-indexing or 0-indexing as appropriate) such that \(S_i \neq T_i\). If the strings are of different lengths or if the number of differing positions is not exactly one, then the transformation is not possible, and the answer is No
.
inputFormat
The first line contains an integer \(Q\) representing the number of test cases. Each of the following \(Q\) lines contains two space-separated strings \(S\) and \(T\).
outputFormat
For each test case, print a single line containing Yes
if \(S\) can be transformed into \(T\) by changing exactly one character, or No
otherwise.
3
abc adc
abcd abcf
abc abc
Yes
Yes
No
</p>