#include <iostream>
int func( int n )
{
int pos = 0, index = 0;
while ( n )
index++;
if ( n % 10 == 8 ) pos = index;
n /= 10;
}
return pos;
int main()
std::cout << func( 128346584 ) << std::endl;
return 0;
#include <iostream>
int func( int n )
{
int pos = 0, index = 0;
while ( n )
{
index++;
if ( n % 10 == 8 ) pos = index;
n /= 10;
}
return pos;
}
int main()
{
std::cout << func( 128346584 ) << std::endl;
return 0;