fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. char c1[100],c2[100];
  5. scanf("%s%s",c1,c2);
  6. for (int i = 0;i < 100;i ++){
  7. if (c1[i] != c2[i]){
  8. if (i == 0){
  9. printf("No common prefix");
  10. break;
  11. }
  12. else {
  13. break;
  14. }
  15. }
  16. printf("%c",c1[i]);
  17. }
  18. return 0;
  19. }
  20.  
Success #stdin #stdout 0s 5284KB
stdin
flower flow
stdout
flow