You are on page 1of 1

#include<iostream>

Using namespace std;

main(){

string s1;

cin>>s1;

cout<<s1;

// string::find_first_not_of
#include <iostream> // std::cout
#include <string> // std::string
#include <cstddef> // std::size_t

int main ()
{
std::string str ("look for non-alphabetic characters...");

std::size_t found = str.find_first_not_of("abcdefghijklmnopqrstuvwxyz ");

if (found!=std::string::npos)
{
std::cout << "The first non-alphabetic character is " << str[found];
std::cout << " at position " << found << '\n';
}

return 0;
}

std::size_t is commonly used for array indexing and loop counting. Programs that use other types, such
as unsigned int, for array indexing may fail on, e.g. 64-bit systems when the index exceeds UINT_MAX or if
it relies on 32-bit modular arithmetic.

You might also like