Advertisement
domybest100

July_week3_7)특정 문자 개수 구하기

Jul 17th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.26 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4. int main() {
  5.     string input; char c; int answer = 0;
  6.     getline(cin, input);
  7.     cin >> c;
  8.     for (int i = 0; i < input.length(); i++) if (input[i] == c) answer++;
  9.     cout << answer << endl;
  10.     return 0;
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement