Strings Problem Set 6

Part I - Raptor Programs

String.16 Double Char

Given a string, display a string where for every char in the original, there are two chars.

Test Case
Input
Program Output
1 The TThhee
2 AABB AAAABBBB
3 Hi-There HHii--TThheerree

Solutions:

python

raptor

String.17 Count Hi

Display the number of times that the string "hi" appears anywhere in the given string.

Test Case
Input
Program Output
1 abc hi ho 1
2 ABChi hi 2
3 hihi 2

Solutions:

python

raptor

String.18 Cat Dog

Display true if the string "cat" and "dog" appear the same number of times in the given string.

Test Case
Input
Program Output
1 catdog true
2 catcat false
3 1cat1cadodog true

Solutions:

python

raptor