Cody

Solution 2099471

Submitted on 20 Jan 2020 by Shlomi Shomonov
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
sentence = 'this is BETTER than C++'; corrected = 'This Is Better Than C++'; assert(isequal(autoCase(sentence), corrected))

sentence = 'this is better than c++' sentence = 'This is better than c++' d = 84 104 105 115 32 105 115 32 98 101 116 116 101 114 32 116 104 97 110 32 99 43 43 i = 1×23 logical array 0 0 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 j = 5 8 15 20 j = 6 9 16 21 v = 105 98 116 99 v = 73 66 84 67 d = 84 104 105 115 32 73 115 32 66 101 116 116 101 114 32 84 104 97 110 32 67 43 43 corrected = 'This Is Better Than C++'

2   Pass
sentence = 'hEy, tHis iS vErY wroNg!'; corrected = 'Hey, This Is Very Wrong!'; assert(isequal(autoCase(sentence), corrected))

sentence = 'hey, this is very wrong!' sentence = 'Hey, this is very wrong!' d = 72 101 121 44 32 116 104 105 115 32 105 115 32 118 101 114 121 32 119 114 111 110 103 33 i = 1×24 logical array 0 0 0 0 1 0 0 0 0 1 0 0 1 0 0 0 0 1 0 0 0 0 0 0 j = 5 10 13 18 j = 6 11 14 19 v = 116 105 118 119 v = 84 73 86 87 d = 72 101 121 44 32 84 104 105 115 32 73 115 32 86 101 114 121 32 87 114 111 110 103 33 corrected = 'Hey, This Is Very Wrong!'

3   Pass
sentence = 'tHIS sENTENCE wILL bE iNVERTED'; corrected = 'This Sentence Will Be Inverted'; assert(isequal(autoCase(sentence), corrected))

sentence = 'this sentence will be inverted' sentence = 'This sentence will be inverted' d = 84 104 105 115 32 115 101 110 116 101 110 99 101 32 119 105 108 108 32 98 101 32 105 110 118 101 114 116 101 100 i = 1×30 logical array 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 j = 5 14 19 22 j = 6 15 20 23 v = 115 119 98 105 v = 83 87 66 73 d = 84 104 105 115 32 83 101 110 116 101 110 99 101 32 87 105 108 108 32 66 101 32 73 110 118 101 114 116 101 100 corrected = 'This Sentence Will Be Inverted'

4   Pass
sentence = 'This Sentence Will Not Be Changed'; corrected = 'This Sentence Will Not Be Changed'; assert(isequal(autoCase(sentence), corrected))

sentence = 'this sentence will not be changed' sentence = 'This sentence will not be changed' d = Columns 1 through 30 84 104 105 115 32 115 101 110 116 101 110 99 101 32 119 105 108 108 32 110 111 116 32 98 101 32 99 104 97 110 Columns 31 through 33 103 101 100 i = 1×33 logical array 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0 0 1 0 0 0 0 0 0 0 j = 5 14 19 23 26 j = 6 15 20 24 27 v = 115 119 110 98 99 v = 83 87 78 66 67 d = Columns 1 through 30 84 104 105 115 32 83 101 110 116 101 110 99 101 32 87 105 108 108 32 78 111 116 32 66 101 32 67 104 97 110 Columns 31 through 33 103 101 100 corrected = 'This Sentence Will Not Be Changed'

5   Pass
sentence = 'HELLO THERE'; corrected = 'Hello There'; assert(isequal(autoCase(sentence), corrected))

sentence = 'hello there' sentence = 'Hello there' d = 72 101 108 108 111 32 116 104 101 114 101 i = 1×11 logical array 0 0 0 0 0 1 0 0 0 0 0 j = 6 j = 7 v = 116 v = 84 d = 72 101 108 108 111 32 84 104 101 114 101 corrected = 'Hello There'

6   Pass
sentence = 'AlTeRnAtInG cApS'; corrected = 'Alternating Caps'; assert(isequal(autoCase(sentence), corrected))

sentence = 'alternating caps' sentence = 'Alternating caps' d = 65 108 116 101 114 110 97 116 105 110 103 32 99 97 112 115 i = 1×16 logical array 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 j = 12 j = 13 v = 99 v = 67 d = 65 108 116 101 114 110 97 116 105 110 103 32 67 97 112 115 corrected = 'Alternating Caps'