Algorithm(CodeTree, C++)/문자열
[코드트리] 특정 문자로 끝나는 문자열 C++
kurooru
2024. 6. 9. 10:52
#include <iostream>
#include <string>
using namespace std;
#define TEN 10
int main() {
// input
string word_list[TEN];
for (int i = 0; i < TEN; i++) {
cin >> word_list[i];
}
char target;
cin >> target;
// print
int last_idx;
for (int i = 0; i < TEN; i++) {
last_idx = word_list[i].length() - 1;
if (word_list[i][last_idx] == target) {
cout << word_list[i] << endl;
}
}
return 0;
}
코드트리 | 코딩테스트 준비를 위한 알고리즘 정석
국가대표가 만든 코딩 공부의 가이드북 코딩 왕초보부터 꿈의 직장 코테 합격까지, 국가대표가 엄선한 커리큘럼으로 준비해보세요.
www.codetree.ai