Strings Problem Set 7

Part I - Raptor Programs

String.19 Count Code

Display the number of times that the string "code" appears anywhere in the given string, except we'll accept any letter for the 'd', so "cope" and "cooe" count.

Test Case
Input
Program Output
1 aaacodebbb 1
2 codexxcode 2
3 cozexxcope 2

Solutions:

python

raptor

String.20 End Other

Given two strings, display true if either of the strings appears at the very end of the other string, ignoring upper/lower case differences (in other words, the computation should not be "case sensitive").

Test Case
Input
Input
Program Output
1 Hiabc abc true
2 AbC HiaBc true
3 abc abXabc true

Solutions:

python

raptor

String.21 XYZ Three

Display true if the given string contains an appearance of "xyz" where the xyz is not directly preceeded by a period (.). So "xxyz" counts but "x.xyz" does not.

Test Case
Input
Program Output
1 abcxyz true
2 abc.xyz false
3 xyz.abc true

Solutions:

python

raptor