# How are both of these things possible at the same time

**URL:** <https://forum.codecrafters.io/t/how-are-both-of-these-things-possible-at-the-same-time/10425>\
**Category:** Challenges\
**Tags:** challenge:shell\
**Created:** [May 12, 2025, 4:44pm UTC](https://forum.codecrafters.io/t/how-are-both-of-these-things-possible-at-the-same-time/10425 "2025-05-12T16:44:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![logan1o1](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/logan1o1/32/10383_2.png) [@logan1o1](https://forum.codecrafters.io/u/logan1o1)\
**Post date:** [May 12, 2025, 4:44pm UTC](https://forum.codecrafters.io/t/how-are-both-of-these-things-possible-at-the-same-time/10425/1 "2025-05-12T16:44:52Z")

</div>

Challenge: #NI6

how is both of these supposed to work, I made it so it removes the extra spaces, but the it again supposed to keep the extra spaces.

Can anyone point out what am I missing

the log

```auto
[tester::#NI6] ✓ Received expected response
[your-program] $ echo test script
[your-program] test script
[tester::#NI6] ✓ Received expected response
[your-program] $ echo 'example hello' 'script''world'
[your-program] example hello scriptworld
[tester::#NI6] Output does not match expected value.
[tester::#NI6] Expected: "example hello scriptworld"
[tester::#NI6] Received: "example hello scriptworld"
[your-program] $ 
[tester::#NI6] Assertion failed.
[tester::#NI6] Test failed

```

---

<div class="post-metadata">

**Author:** ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Post date:** [May 13, 2025, 9:37pm UTC](https://forum.codecrafters.io/t/how-are-both-of-these-things-possible-at-the-same-time/10425/4 "2025-05-13T21:37:26Z")

</div>

Hey @logan1o1

- Spaces **inside quotes** should be preserved.
- If two quoted strings have **no space between them** , they’re treated as **one token**.

 ![image](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/2X/0/0b57d965a2ed5eeb9631eb19bad33847808b4da7.png)

```auto
Expected: "example hello scriptworld"

```

Let me know if you’d like further clarification!

---

<div class="post-metadata">

**Author:** ![EshaanAgg](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/eshaanagg/32/399_2.png) [@EshaanAgg](https://forum.codecrafters.io/u/EshaanAgg)\
**Post date:** [May 14, 2025, 11:07am UTC](https://forum.codecrafters.io/t/how-are-both-of-these-things-possible-at-the-same-time/10425/6 "2025-05-14T11:07:24Z")

</div>

Even I had the same doubt that you’re mentioning, and it helped me to realize the more general rule that bash shells follow: **end of a quoted string does not necessarily mean end of a token**. You should only end a token when you recieve either:

- A whitespace
- A tab
- End of input  
(Goes without say that these should be in an unquoted string and not escaped)

---

<div class="post-metadata">

**Author:** ![logan1o1](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/logan1o1/32/10383_2.png) [@logan1o1](https://forum.codecrafters.io/u/logan1o1)\
**Post date:** [May 14, 2025, 2:30pm UTC](https://forum.codecrafters.io/t/how-are-both-of-these-things-possible-at-the-same-time/10425/7 "2025-05-14T14:30:08Z")

</div>

Yeah, solved, it took a while but got it

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/3X/7/0/700657133935c15703e22c7c8870394f6e6dc27d.svg) [@system](https://forum.codecrafters.io/u/system)\
**Post date:** [May 25, 2025, 7:27am UTC](https://forum.codecrafters.io/t/how-are-both-of-these-things-possible-at-the-same-time/10425/8 "2025-05-25T07:27:05Z")

</div>

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.
