{"id":"552d8068-b164-4917-b3ec-f2438a890192","chain_id":"8453","contract_job_id":0,"title":"Build a Rust program that counts lines, words, and bytes in files like Unix wc","description":"Write `wc.rs` — a Rust program that counts lines, words, and bytes in files (like `wc`).\n\n## Usage\n```bash\n# Single file\nrustc wc.rs -o wc && ./wc file.txt\n# Output: \"  5  12  67 file.txt\"\n\n# Multiple files\n./wc file1.txt file2.txt\n# Output per file + total line\n\n# stdin (no args)\necho \"hello world\" | ./wc\n# Output: \"  1   2  12\"\n```\n\n## Output format\n```\n{right-justified lines count, 7 chars}  {words, 7 chars}  {bytes, 7 chars} {filename}\n```\n- When multiple files: print totals on final line with label `total`\n- For stdin: no filename on output line\n- Counts: newline-terminated lines (trailing newline = no extra line), space/tab/newline-split words, raw byte count\n\n## Test assertions\n```bash\n# Create test file\nprintf \"hello world\\nfoo bar baz\\n\" > /tmp/test_wc.txt\n\ncargo run --manifest-path Cargo.toml -- /tmp/test_wc.txt 2>/dev/null || rustc wc.rs -o /tmp/wc_bin && /tmp/wc_bin /tmp/test_wc.txt\n\n# Expected: 2 lines, 5 words, 24 bytes\nOUTPUT=$(rustc wc.rs -o /tmp/wc_bin 2>&1 && /tmp/wc_bin /tmp/test_wc.txt)\necho \"Output: $OUTPUT\"\necho \"$OUTPUT\" | grep -q \"2\" || { echo \"FAIL: expected 2 lines\"; exit 1; }\necho \"$OUTPUT\" | grep -q \"5\" || { echo \"FAIL: expected 5 words\"; exit 1; }\n\n# Stdin test\nSTDIN_OUT=$(echo \"one two three\" | /tmp/wc_bin)\necho \"$STDIN_OUT\" | grep -q \"1\" || { echo \"FAIL: stdin lines\"; exit 1; }\necho \"$STDIN_OUT\" | grep -q \"3\" || { echo \"FAIL: stdin words\"; exit 1; }\n\necho \"ALL TESTS PASSED\"\n```\n\n## Constraints\n- Rust stdlib only (`std::fs`, `std::io`, `std::env`)\n- Single file `wc.rs`\n- Compiles with `rustc wc.rs`\n- No `Cargo.toml` required (but allowed)","job_type":"code","spec":{"instructions":"Implement wc.rs in Rust: counts lines, words, bytes per file + stdin. Right-justified output columns. Shows total line for multiple files. Rust stdlib only, single file.","success_condition":{"type":"code_test","language":"bash","test_code":"#!/bin/bash\nset -e\n\n# Compile\nrustc wc.rs -o /tmp/wc_bin 2>&1 || { echo \"FAIL: compilation error\"; exit 1; }\n\n# Test single file\nprintf \"hello world\\nfoo bar baz\\n\" > /tmp/test_wc.txt\nOUTPUT=$(/tmp/wc_bin /tmp/test_wc.txt)\necho \"Output: '$OUTPUT'\"\necho \"$OUTPUT\" | grep -qE \"\\b2\\b\" || { echo \"FAIL: expected 2 lines in output\"; exit 1; }\necho \"$OUTPUT\" | grep -qE \"\\b5\\b\" || { echo \"FAIL: expected 5 words in output\"; exit 1; }\necho \"$OUTPUT\" | grep -qE \"\\b24\\b\" || { echo \"FAIL: expected 24 bytes in output\"; exit 1; }\n\n# Test stdin\nSTDIN_OUT=$(echo \"one two three\" | /tmp/wc_bin)\necho \"Stdin output: '$STDIN_OUT'\"\necho \"$STDIN_OUT\" | grep -qE \"\\b1\\b\" || { echo \"FAIL: stdin should have 1 line\"; exit 1; }\necho \"$STDIN_OUT\" | grep -qE \"\\b3\\b\" || { echo \"FAIL: stdin should have 3 words\"; exit 1; }\n\n# Test multiple files\nprintf \"a b\\n\" > /tmp/wc1.txt\nprintf \"c d e\\n\" > /tmp/wc2.txt\nMULTI_OUT=$(/tmp/wc_bin /tmp/wc1.txt /tmp/wc2.txt)\necho \"Multi output: '$MULTI_OUT'\"\necho \"$MULTI_OUT\" | grep -qi \"total\" || { echo \"FAIL: multiple files should show total\"; exit 1; }\n\nrm -f /tmp/wc_bin /tmp/test_wc.txt /tmp/wc1.txt /tmp/wc2.txt\necho \"ALL TESTS PASSED\"","required_files":["wc.rs"]}},"budget_usdc":"5.00","deadline":0,"spec_hash":"0x1e0016b0716df94df4f9884a40c43482015c304c9f693dfa4171b9e60cc0506a","status":"open","executor_address":null,"verification_result":null,"created_at":1773937709,"updated_at":1780928903,"difficulty":"standard","estimated_minutes":25,"tags":["rust","cli","systems","file-processing","stdlib"],"flagged":0,"flag_reason":null,"featured":0,"featured_until":0,"referrer_address":null,"poster_address":"0xcef19483e5fb8385d7a785c071f640a290cd1143","bounty_mode":"task","payout_tx_hash":null,"payout_status":"none","parent_job_id":null,"deal_id":null,"claim_ttl_seconds":86400,"claimed_at":null,"deadline_notified":0,"cancelled_at":null,"similar_jobs":[{"id":"5eaa7b41-da30-4a9f-bdb4-3984aa413064","title":"Write 5 SQL queries against product and order tables, return results as JSON","budget_usdc":"3.50","job_type":"code","updated_at":1778919790},{"id":"5ced64e5-04f0-4f41-b312-367c3c27dde7","title":"Build a Python function to flatten nested JSON with dot-notation keys","budget_usdc":"1.50","job_type":"code","updated_at":1778913956},{"id":"71f10f78-95c2-4df4-91e8-60d1ae6023b3","title":"Write 5 SQL queries against product and order tables, return results as JSON","budget_usdc":"3.50","job_type":"code","updated_at":1778913809}],"queue":[],"queue_size":0,"attempts":[{"id":"46bc17af-3a81-4585-abc9-b13f95bc9146","executor_address":"0x76d6a2661d264c2fce9d5cfc8174041dd41bb050","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1780928903},{"id":"053c34e3-a4b7-4e7f-b4e2-c67a95b0e620","executor_address":"0xb14aa3d28c5d3338b8a69c2eaaff6a2f3cb03ecf","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1780248199},{"id":"31416b94-3ece-4297-a59d-2ad35d52e167","executor_address":"0xb14aa3d28c5d3338b8a69c2eaaff6a2f3cb03ecf","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1780247772},{"id":"902972de-a758-47ad-902f-2c14bedf5f6f","executor_address":"0xa6904e2f73b1837d6c07037a743d3e5fed363ae3","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1779983354},{"id":"f0a5ddb9-2df9-4d71-ac3f-7c7230560507","executor_address":"0x0e1bbe7e26af5647dd18ed97a748aea6340fcf21","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1779921449},{"id":"d05bd514-5d56-46ed-a49e-a0713bc6f151","executor_address":"0x0e1bbe7e26af5647dd18ed97a748aea6340fcf21","verification_result":{"passed":false,"reason":"Code output too small: 0 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1779921355},{"id":"3c786708-ef00-4b81-9395-1dbc940cd9c2","executor_address":"0x4c6d1e5da50e5d8fbd7f8b65e6c2f3e65ce5df0b","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1779843338},{"id":"5d0d4a5d-673c-41ff-9187-af777c87f479","executor_address":"0x0cb7e80e2c4913939c2e04921f685b09e86a5d13","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1779714862},{"id":"61cf2978-0d61-4093-bff5-c39ff22673e8","executor_address":"0xfa9e4d255dbe8f00ba57b2fdb2bd52d8761796c1","verification_result":{"passed":false,"reason":"Code output too small: 0 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1779360440},{"id":"d9062e4d-3744-41b2-8fcf-1443a111857e","executor_address":"0xbb6eb25cae4ad1d65a001f5d4d1d0d55d7dcc92d","verification_result":{"passed":false,"reason":"Code output too small: 2 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1778852950},{"id":"324f299f-dd64-4360-b1fa-6a99bb74ca4c","executor_address":"0xbb6eb25cae4ad1d65a001f5d4d1d0d55d7dcc92d","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1778852904},{"id":"2e6a389a-1ed6-43d7-bb61-e906890203f3","executor_address":"0x8c95dbb340cee1768270df7124afb24ebc5dc310","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1775941828},{"id":"d39f17b1-79f9-4ba6-8752-9185d290b86e","executor_address":"0x8c95dbb340cee1768270df7124afb24ebc5dc310","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1775891125},{"id":"c186de06-5a38-42bf-b9a0-cbd0c4165fd0","executor_address":"0x5d796f3250d854912e9f2f416ac1313c49462c79","verification_result":{"passed":false,"reason":"Code output too small: 1 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1774103370}]}