How to find large consecutive substring from a string.

Hi,
please tell me how i can find large consecutive substring from a string.
For Example:
Input is : ABCQWERSTUVWNOL
out put should be: RSTUVW
Try strstr().
http://www.cplusplus.com/reference/clibrary/cstring/strstr/

Unless you are supposed to write your own substring search. If so, to get you going in the right direction think about how you would find a string inside a string. I would begin by trying to find the first letter of the string I'm looking for inside of the string I'm searching through.
Just keep track of the current substring length (and start position) and if a character doesn't match, reset it to one.
@bradw, he's not looking for a known string, but for a part of alphabet.

@OP, There are several ways to write this. I'll give you the least efficient one:
1
2
3
4
5
const char* str = "ABCQWERSTUVWNOL";
for (int i = 0; str[i] != 0; i++) //for each char in str...
   for (int j = 1; str[i+j] - str[i] == j; j++) //the condition means 'while characters progress in a linear way'
      //if this line is executed, you've found several consecutive chars between indexes i and i+j
      //you'll want to have a "char* start" and "int length" outside the loops to remember the longest of them. 
Notice that some characters are processed several times. You really only need one loop (or one counter).
Topic archived. No new replies allowed.