728x90
반응형
#include <iostream>
#include <string>
using namespace std;
int countSteps(const string& str) {
int count = 0;
for (char c : str) {
if (c == 'D') break;
count++;
}
return count;
}
int main() {
int T;
cin >> T;
for (int i = 0; i < T; i++) {
string test;
cin >> test;
int steps = countSteps(test);
cout << steps << endl;
}
return 0;
}
728x90
반응형
'Baekjoon > Bronze' 카테고리의 다른 글
Baekjoon 2292.벌집 c++ [Bronze II] (0) | 2024.11.10 |
---|---|
Baekjoon 2231. Digit Generator c++ [Bronze II] (0) | 2024.11.06 |
Baekjoon 10809. 알파벳 찾기 c++[Bronze II] (0) | 2024.11.03 |
Baekjoon 1152. 단어의 개수 c++[Bronze II] (0) | 2024.11.03 |
Baekjoon 2605. 줄세우기 c++[Bronze II] (0) | 2024.10.23 |