[ create a new paste ] login | about

Link: http://codepad.org/26kJ3bUK    [ raw code | output | fork ]

C++, pasted on Nov 2:
#include <stdio.h>
#include <string.h>

int main(int argc, char* argv[])
{
	char str[256] = "aabbbrraaacccaaddaabbbbrrrraaa\0";

	printf("%s\n",str);

	bool found = false;
	for (int i = 0; str[i] != '\0' && !found; i++)
	{
		int count = 0;
		for (int j = i+1; str[j] != '\0' && !found; j++)
			if (str[j] == str[i])
			{
				found = false; char pchars[] = "ab";
				for (int k = i+1; k <= j-1 && !found; k++)
					found = strchr(pchars,str[k]) ? 1 : 0;
			}
	}

	if (found != false)
		printf("okey...\n");
}


Output:
1
2
aabbbrraaacccaaddaabbbbrrrraaa
okey...


Create a new paste based on this one


Comments: