알고리즘

[알고리즘] 백준 10173 - 니모를 찾아서 (C++)

blueberrysoda 2025. 4. 9. 23:36

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

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main(){
    string S;
    while(true){
        getline(cin, S);
        if(S == "EOI"){
            break;
        }

        bool flag = 0;
        transform(S.begin(), S.end(), S.begin(), ::tolower);
       
        if(S.length() > 3){
            for(int i=0; i<S.length()-3; i++){
                if(S.substr(i, 4) == "nemo"){
                    flag = 1;
                    break;
                }
            }
        }

        if(flag){
            cout << "Found\n";
        }
        else{
            cout << "Missing\n";
        }
    }

    return 0;
}