Guest User

Untitled

a guest
Dec 17th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main()
  5. {
  6.  
  7. char password[11];
  8. int i, j, reject = 0;
  9.  
  10. printf("Enter the password: ");
  11. scanf("%s", password);
  12.  
  13. for(i = 1; i < strlen(password)/2 + 1; i++)
  14. {
  15. for(j = 0; j < strlen(password) - i; j += 1)
  16. {
  17. if(!strncmp(&password[j], &password[j+i], i))
  18. {
  19. reject = 1;
  20. break;
  21. }
  22.  
  23. }
  24. if(reject)
  25. break;
  26.  
  27. }
  28. if(reject)
  29. printf("Rejected.");
  30. else
  31. printf("Accepted.");
  32. }
Add Comment
Please, Sign In to add comment