fork download
  1. #include <iostream>
  2. #include <stdio.h>
  3. int main() {
  4. char a[5];
  5. char b[6];
  6. const char* p = "word word2 , word";
  7. sscanf(p, "%4[^ ]%*[ ]%5[^ ]", a, b);
  8. std::cout << a << std::endl;
  9. std::cout << b << std::endl;
  10. return 0;
  11. }
Success #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
word
word2