There are several strings of letters that replacing the asterisks in
I******US create a valid English word.
1. Two of them vary only by one letter.
2. Nonetheless, they are totally incompatible, almost contradictory.
Find them.
Not being sure if there was to be a 1-for-1 replacement of each asterisk with a letter, and also just for the heck of it, learning how to sort words by length (using the built-in sort capability of the language) along the way, I wrote a program to find all I_______US words:
clearvars,clc
words={};lngths=[];
fid=fopen('c:\words\words.txt','r');
while ~feof(fid)
w=fgetl(fid);
if length(w)>3
if w(1)=='i' && isequal(w(end-1:end) , 'us')
lngths=length(w);
words{end+1}=w;
end
end
end
[~,stringLength] = sort(cellfun(@length,words),'descend');
OutputListSorted = words(stringLength);
OutputListSorted'
ans =
66×1 cell array
{'ichthyophagous'}
{'interreligious'}
{'intracutaneous'}
{'inconspicuous' }
{'inefficacious' }
{'inhomogeneous' }
{'insectivorous' }
{'instantaneous' }
{'interstimulus' }
{'impetiginous' }
{'inauspicious' }
{'incommodious' }
{'infelicitous' }
{'inharmonious' }
{'insalubrious' }
{'ignominious' }
{'illustrious' }
{'impecunious' }
{'incongruous' }
{'incredulous' }
{'industrious' }
{'injudicious' }
{'intercampus' }
{'intravenous' }
{'irreligious' }
{'isochronous' }
{'isomorphous' }
{'idolatrous' }
{'impervious' }
{'impromptus' }
{'incautious' }
{'incestuous' }
{'indecorous' }
{'indigenous' }
{'infectious' }
{'inglorious' }
{'iniquitous' }
{'innumerous' }
{'ignoramus' }
{'imperious' }
{'impetuous' }
{'incurious' }
{'ingenious' }
{'ingenuous' }
{'injurious' }
{'innocuous' }
{'insidious' }
{'invidious' }
{'isogamous' }
{'ichorous' }
{'idoneous' }
{'imporous' }
{'inconnus' }
{'infamous' }
{'icterus' }
{'igneous' }
{'impetus' }
{'impious' }
{'incubus' }
{'isthmus' }
{'iambus' }
{'iodous' }
{'ictus' }
{'iglus' }
{'ileus' }
{'incus' }
The sort put equal-length words next to one another, including INGENIOUS (clever, original, and inventive.) and INGENUOUS (innocent and unsuspecting). And this does have a 1-for-1 match with the asterisks.
Nicely, within length, the sort preserved the existing order (alphabetical) within same-length sets.
|
Posted by Charlie
on 2022-05-09 08:33:26 |