updated template to use updated input
This commit is contained in:
@@ -1,7 +1,30 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import "fmt"
|
import (
|
||||||
|
"bufio"
|
||||||
|
"fmt"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
func original() {
|
func original() {
|
||||||
fmt.Println("Original Code")
|
fmt.Println("Original Code")
|
||||||
|
|
||||||
|
// Open the input file
|
||||||
|
file, err := os.Open("./input.txt")
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("Error opening input.txt: %v", err)
|
||||||
|
}
|
||||||
|
defer file.Close()
|
||||||
|
|
||||||
|
// Read and parse input file
|
||||||
|
scanner := bufio.NewScanner(file)
|
||||||
|
for scanner.Scan() {
|
||||||
|
line := strings.Fields(scanner.Text())
|
||||||
|
if len(line) != 2 {
|
||||||
|
log.Fatalf("Invalid input format: %s", scanner.Text())
|
||||||
|
}
|
||||||
|
//
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user