알고리즘

[알고리즘] 백준 17249 - 태보태보 총난타 (C++)

blueberrysoda 2025. 6. 3. 23:07

[문제 링크] : https://www.acmicpc.net/problem/17249

#include <iostream>
using namespace std;

int main(){
    string S;
    int s = 0, e = 0, t = 0;
    
    cin >> S;
    for(int i=0; i<S.size(); i++){
        if(S[i] == '@' && t == 0){
            s++;
        }
        if(S[i] == '@' && t == 1){
            e++;
        }
        if(S[i] == '0'){
            t = 1;
        }
    }
    cout << s << " " << e << "\n";
    return 0;
}