#include <string>
#include <vector>
using namespace std;
string solution(string s) {
     string answer = "";
    
    if(s.length()%2==0)
        answer += s.at(s.length()/2-1);  // at 함수. 문자열 내 특정 위치에 있는 문자를 반환한다.
    answer += s.at(s.length()/2);    
   
    return answer;
}'코딩테스트 > 프로그래머스' 카테고리의 다른 글
| [Level 1][C++] x만큼 간격이 있는 n개의 숫자 (0) | 2024.09.27 | 
|---|---|
| [Level 1][C++] 행렬의 덧셈 (0) | 2024.09.27 | 
| [Level 1][C++] 시저 암호 (0) | 2024.09.27 | 
| [Level 1][C++] 문자열 내림차순으로 배치하기 (0) | 2024.09.27 | 
| [Level 1][C++] 서울에서 김서방 찾기 (0) | 2024.09.27 |