Write a function which checks if a scrambled version of a sentence can still be understood.
The human brain is an amazing thing. It allows you to understand text even if letters are scrambled into a random order, as long as the first and last letter are in order.
e.g. according to the statement above, the following text should still be understandable
1| The hmuan barin is an aanmizg titng.
2| It aolwls you to unrseatndd txet eevn if leretts are scrbmlead itno a ranodm oedr,
3| as lnog as the frist and last letetr are in order.
For the scrambled text to be counted as understood, all of these criteria must be met: -there should be the same number of words as the original text as the scrambled text -each word should be the same length -the first and last letter of each word should be the same -the characters in the middle of each word could be anything as long as they are the same length as the original word
Test data
Expected return value
UnderstandablyScrambled("Hello", "Hlelo")
True
UnderstandablyScrambled("Hello", "Hllo")
False:all letters must be used
UnderstandablyScrambled("The human brain","The hmuan barin")
True
UnderstandablyScrambled("The human brain","The hmuan barin ")
False: trailing whitespace
UnderstandablyScrambled("is an amazing thing","is an amzanig thnig")
True
UnderstandablyScrambled("is an amazing thing","is an aamzanig thnig")
False: too many characters in the scrambled word amazing
public static bool UnderstandablyScrambled(string original, string scrambled) {
// e.g. UnderstandablyScrambled("Hello", "Hlelo") should return true
}
Test
body
Previous attempts
You do not have any previously submitted code saved for this challenge
My Challenges
You do not have any C# challenges assigned for you to do