#include <iostream>
#include <cmath>
#include <string>
using namespace std;
int main()
{
int counter[256]{ 0 };
string s;
getline(cin, s);
for (int i = 0; i < s.size(); i++)
{
counter[s[i]] += 1;
}
cout << counter[97] << endl;
cout << counter[98] << endl;
}
구조만 간단하게 만들어 보았고 수정을 해보시길 바랍니다.
[C++] vector 배열 내, 문자열 값들을 sort()하기 (0) | 2022.07.04 |
---|---|
[C++] 콘솔창에 원 그리기 (0) | 2022.07.02 |
[C++] sqrt() 함수 (0) | 2022.07.02 |
[C++] pow() 함수 (0) | 2022.07.02 |
[C++] std::string 초기화 기법 (0) | 2022.07.02 |
댓글 영역