Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- 이분탐색
- 게임개발
- 개발일지
- 유니티
- BFS
- 운영체제
- 인프런
- c++
- unity
- DFS
- 게임개발공모전
- 안드로이드
- fsm
- 재귀
- 언리얼
- 구현
- c#
- 웅진씽크빅
- upper_bound
- lower_bound
- 백준
- 알고리즘
- 유한상태기계
- 프로그래머스
- 이득우
- 너비우선탐색
- UI 자동화
- 시리얼라이제이션
- unreal
- binary_search
Archives
- Today
- Total
초고교급 희망
[백준][C++] 1157번 단어 공부 본문
728x90



#include<iostream>
#include<string>
#include <cctype>
using namespace std;
int main()
{
int max = 0, index = 0, arr[26] = {};
int count = 0;
string S;
const string a = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
cin >> S;
//대소문자 변환
for (int i = 0; i < S.length(); i++)
{
S[i] = toupper(S[i]);
arr[a.find(S[i])]++;
}
for (int i = 0; i < 26; i++)
{
if (max < arr[i])
{
max = arr[i];
count = 0;
index = i;
}
if (max == arr[i])
count++;
}
if (count > 1)
cout << "?";
else
cout << (char)(index + 'A');
return 0;
}

728x90
'Algorithm > Baekjoon' 카테고리의 다른 글
[백준][C++]2805번 나무 자르기 (0) | 2022.05.16 |
---|---|
[백준][C++]1072번 게임 (0) | 2022.05.16 |
[백준][Python]10866 0 = not cute / 1 = cute (0) | 2021.08.07 |
[백준][C++]2908번 상수 (0) | 2021.07.09 |
[백준][C++] 4673번 셀프 넘버 (0) | 2021.06.30 |