#include <iostream> #include <string.h> using namespace std; int arr[10]; int main() { ios::sync_with_stdio(0); cin.tie(0); int max = 1; string room; cin >> room; for(auto a : room) { if(a == '6' || a =='9'){ arr[6]++; } else { arr[a-'0']++; } } arr[6] = arr[6] / 2 + arr[6] % 2; for(auto a : arr) { if(a > max) max = a; } cout << max; return 0; }
: char -> int 바꿀 때
char-'0' = int