7 kyu

Cat and Mouse - Easy Version

3,642 of 10,147PG1

Description:

You will be given a string featuring a cat 'C' and a mouse 'm'. The rest of the string will be made up of '.'. The string will start with the cat, and end with the mouse.

You need to find out if the cat can catch the mouse from its current position. The cat can jump over at most three characters. So:

"C.....m" returns "Escaped!" <-- more than three characters between

"C...m" returns "Caught!" <-- as there are three characters between the two, the cat can jump.

Fundamentals
Strings

More By Author:

Check out these other kata created by PG1

Stats:

CreatedSep 30, 2016
PublishedSep 30, 2016
Warriors Trained12732
Total Skips394
Total Code Submissions27078
Total Times Completed10147
JavaScript Completions3642
Ruby Completions394
Python Completions3280
PHP Completions620
Haskell Completions119
C# Completions551
Kotlin Completions797
Crystal Completions10
CoffeeScript Completions11
Julia Completions24
C++ Completions709
TypeScript Completions200
Java Completions168
Total Stars74
% of votes with a positive feedback rating88% of 1444
Total "Very Satisfied" Votes1154
Total "Somewhat Satisfied" Votes237
Total "Not Satisfied" Votes53
Total Rank Assessments28
Average Assessed Rank
7 kyu
Highest Assessed Rank
7 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • PG1 Avatar
  • SagePtr Avatar
  • GiacomoSorbi Avatar
  • raulbc777 Avatar
  • donaldsebleung Avatar
  • nbeck Avatar
  • JohanWiltink Avatar
  • MFazio23 Avatar
  • hobovsky Avatar
  • cliffstamp Avatar
  • cn894 Avatar
  • SergeySinyavskiy Avatar
  • ejini战神 Avatar
  • Just4FunCoder Avatar
Ad