fork download
  1. #include <iostream>
  2. #include <cstring>
  3.  
  4. const char *prefix = "Controller/MCP23017P";
  5.  
  6. int main()
  7. {
  8. static const int len = strlen(prefix);
  9. const char *input1 = "Controller/MCP23017P15/command";
  10. std::cout << atoi(input1 + len) << std::endl;
  11. const char *input2 = "Controller/MCP23017P02/command";
  12. std::cout << atoi(input2 + len) << std::endl;
  13. const char *input3 = "Controller/MCP23017P7/command";
  14. std::cout << atoi(input3 + len) << std::endl;
  15. return 0;
  16. }
Success #stdin #stdout 0s 5444KB
stdin
Standard input is empty
stdout
15
2
7