fork download
  1. #include <iostream>
  2. #include <cstring>
  3.  
  4. int get_char_code_at_position(char * string, int position) {
  5. return (int) (string[position - 1]);
  6. }
  7.  
  8. int main() {
  9. char input[256];
  10.  
  11. printf("Enter flag to check: ");
  12. scanf("%s", input);
  13. if (strlen(input) * 4 != get_char_code_at_position(input, 1)) {
  14. printf("Wrong length!\n");
  15. return 0;
  16. }
  17.  
  18. std::cout << strncmp(input, "4_points", 8) << std::endl;
  19.  
  20. if (strncmp(input, "4_points", 8)) {
  21. printf("Wrong check 1!\n");
  22. return 0;
  23. }
  24. if (strcmp(&input[8], "komne") != 0) {
  25. printf("Wrong check 2!\n");
  26. return 0;
  27. }
  28. printf("Yes! Correct flag is %s\n", input);
  29. return 0;
  30. }
  31.  
Success #stdin #stdout 0.01s 5280KB
stdin
4_pointskomne
stdout
Enter flag to check: 0
Yes! Correct flag is 4_pointskomne