fork download
  1. #include <stdio.h>
  2. #include<string.h>
  3. #define ll long long
  4.  
  5. int main()
  6. {
  7.  
  8. char b[40]={'\0'};
  9. scanf("%[^\n]",b);
  10. int len = 0;
  11. // cout<<b.length()<<endl;
  12. int x=strlen(b);
  13. for (int i = 0; i < x; i++)
  14. {
  15. if (b[i] == ',')
  16. {
  17. continue;
  18. }
  19. else
  20. {
  21. len++;
  22. }
  23. }
  24. //printf("%d ",len);
  25. char a[len][2];
  26. ll j = 0;
  27. ll cnt = 0;
  28. ll store = 0;
  29. for (int i = 0; i < x; i++)
  30. { ll cnt1=0;
  31. if (b[i] == ',')
  32. {
  33. store = i;
  34. //printf("%d ",store);
  35. //cout<<store<<endl;
  36. for (int k = j; k < i; k++)
  37. {
  38. a[cnt][cnt1]= b[k];
  39. printf("%c",a[cnt][cnt1]);
  40.  
  41. // cout<<a[cnt]<<" ";
  42. // printf("%c",b[k]);
  43. //cout<<b[k]<<endl;
  44. cnt1++;
  45. //printf("%d ",cnt1);
  46. }
  47. printf("\n");
  48. cnt++;
  49. //printf("%d ",cnt);
  50. j = i + 1;
  51. // cout<<j<<endl;
  52. }
  53. }
  54. printf("\n");
  55. for(int i=0;i<=5;i++)
  56. {
  57. printf("string = %s \t address = %u\n", a + i, a + i);
  58. }
  59. // printf("%s",a[0]);
  60.  
  61. return 0;
  62. }
Success #stdin #stdout 0s 5428KB
stdin
25,9,6,*,-,3,/
stdout
25
9
6
*
-
3

string = 259x6* 	 address = 2028942576
string = 9x6* 	 address = 2028942578
string = 6* 	 address = 2028942580
string = * 	 address = 2028942582
string = -@3DYU 	 address = 2028942584
string = 3DYU 	 address = 2028942586