import scala.io.StdIn

object Main extends App {

  private val w = StdIn.readLine()
  val wsize = w.length
  var text = ""
  var cnt = 0
  

  def loop(index: Int, target: String): Unit = {
    if(index >= 0){
      val next = target.indexOf(w,index)
      if(next >= 0) {
        cnt +=1
        loop(next+wsize, target)
      }
    }
  }

  do {
    loop(0, text)
    text = StdIn.readLine()
  } while(text != "END_OF_TEXT")
  
  println(cnt)
  
}
