머쓱이는 할머니께 생신 축하 편지를 쓰려고 합니다. 할머니가 보시기 편하도록 글자 한 자 한 자를 가로 2cm 크기로 적으려고 하며, 편지를 가로로만 적을 때, 축하 문구 message를 적기 위해 필요한 편지지의 최소 가로길이를 return 하도록 solution 함수를 완성해주세요
| message | result |
|---|---|
| "Happy birthday!" | 30 |
| "I love you!" | 22 |
#include <string>
#include <vector>
using namespace std;
int solution(string message) {
int answer = 0;
answer= message.size()*2;
return answer;
}
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
// 파라미터로 주어지는 문자열은 const로 주어집니다. 변경하려면 문자열을 복사해서 사용하세요.
int solution(const char* message) {
int answer = 0;
answer = strlen(message)*2;
return answer;
}
생신에는 돈인데 아직 머쓱이가 낭만파인가 봅니다..(;´д`)ゞ