[ create a new paste ] login | about

Link: http://codepad.org/WPE1C6np    [ raw code | output | fork ]

C++, pasted on May 16:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <string>
#include <algorithm>
#include <iostream>

int main()
{
   std::string s;
   s = "aa  bbbbbbbbbb cccccccc zzz ggggggg z";
   
   const char symbol = 'z'; // подсчитываем этот символ
   std::cout << std::count(s.begin(), s.end(), symbol) << std::endl;

   return 0;
}


Output:
1
4


Create a new paste based on this one


Comments: