7 kyu

Return substring instance count

2,016 of 8,730jhoffner

Description:

Write a function that takes two string parameters search_text and full_text and returns the number of times the search_text is found within the full_text.

  • Overlap is not permitted: "aaa" contains 1 instance of "aa", not 2.
  • search_text will never be empty.

Examples:

full_text = "aa_bb_cc_dd_bb_e", search_text = "bb"
--> should return 2 since "bb" shows up twice


full_text = "aaabbbcccc", search_text = "bbb"
--> should return 1
Strings
Fundamentals

Stats:

CreatedApr 13, 2013
PublishedJul 24, 2013
Warriors Trained11500
Total Skips975
Total Code Submissions28193
Total Times Completed8730
Ruby Completions2016
JavaScript Completions3382
CoffeeScript Completions246
Python Completions2749
C# Completions335
Haskell Completions78
C Completions70
Java Completions87
Total Stars75
% of votes with a positive feedback rating90% of 1000
Total "Very Satisfied" Votes826
Total "Somewhat Satisfied" Votes144
Total "Not Satisfied" Votes30
Ad
Contributors
  • jhoffner Avatar
  • suic Avatar
  • myjinxin2015 Avatar
  • JohanWiltink Avatar
  • Voile Avatar
  • Madjosz Avatar
  • Souzooka Avatar
  • KenKamau Avatar
  • hobovsky Avatar
  • trashy_incel Avatar
  • akar-0 Avatar
  • tobeannouncd Avatar
  • Just4FunCoder Avatar
  • yLaWy Avatar
  • SummerTheCoder Avatar
Ad