ABC063 B - Varied
問題はこちら atcoder.jp
方針
の各文字について, 内にそれが何個存在するかを数えています。 個以上あればアウト。
コード
#include <bits/stdc++.h> using namespace std; int main(){ string s; cin>>s; bool check=false; for(int i=0; i<s.size(); i++){ int counter=count(s.begin(),s.end(),s[i]); if(counter>=2){ check=true; break; } } if(check==false){ cout<<"yes"<<endl; }else{ cout<<"no"<<endl; } }