Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- int main()
- {
- char password[11];
- int i, j, reject = 0;
- printf("Enter the password: ");
- scanf("%s", password);
- for(i = 1; i < strlen(password)/2 + 1; i++)
- {
- for(j = 0; j < strlen(password) - i; j += 1)
- {
- if(!strncmp(&password[j], &password[j+i], i))
- {
- reject = 1;
- break;
- }
- }
- if(reject)
- break;
- }
- if(reject)
- printf("Rejected.");
- else
- printf("Accepted.");
- }
Add Comment
Please, Sign In to add comment