#45897: 故事的小黃花 從出生那年就飄著


1121226@stu.wghs.tp.edu.tw (Arthur✨EC✨小蜜楓)

學校 : 臺北市私立薇閣高級中學
編號 : 252772
來源 : [60.248.154.139]
最後登入時間 :
2025-05-14 12:52:05
a466. 12289 - One-Two-Three -- UVa12289 | From: [60.248.154.139] | 發表日期 : 2025-04-25 13:06

#include <bits/stdc++.h>
using namespace std;
int main() {
	int n;
	cin>>n;
	while(n--){
	    string s;
	    cin>>s;
	    if(s.length()==5){ // 如果字串長度為5,輸出3
	        cout<<3<<endl;
	    }
	    // 檢查有多少個字符與'o','n','e'匹配  
	    else if((s[0]=='o')+(s[1]=='n')+(s[2]=='e')>=2){
	        // 如果有至少2個字符與'one'匹配,輸出1  
            cout<<1<<endl;
        }
	    else{
	        cout<<2<<endl; // 如果以上條件都不符合,輸出2  
	    }
	}

}
 
ZeroJudge Forum