#include
#include
using namespace std;
int main() {
char s[10];
cin>>s;
int n=strlen(s);
auto lb=lower_bound(s,s+n,‘a’);
cout<<lb-s;
return 0;
}
How to find lower bound of a ? suppose input is cat
@Prabhleen_sheenu lower_bound function accepts a sorted container only because it uses binary search internally, so make sure you sort the container beforehand. https://ide.codingblocks.com/s/257349 you can refer to this code to find the lower_bound of a character in a string.
1 Like
thank you ma’am
