Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
#include <iostream>
using std::cin;
using std::cout;
using std::string;
using std::endl;
int main() {
string sameChars = "aaa";
string notSameChars = "abab";
// std::string::find_first_not_of(hoge) :
// hoge以外の文字が最初に見つかった場所 || string::npos を返す
cout << sameChars.find_first_not_of("a") << endl; // npos
cout << notSameChars.find_first_not_of("a") << endl; // 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment