-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e6ad0e2
commit 11ed8c7
Showing
3 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package main | ||
|
||
import "fmt" | ||
import "log" | ||
import "bufio" | ||
import "os" | ||
import "strings" | ||
|
||
func main() { | ||
file, err := os.Open(os.Args[1]) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
defer file.Close() | ||
|
||
var one int32 = 49 | ||
|
||
scanner := bufio.NewScanner(file) | ||
for scanner.Scan() { | ||
var line string = scanner.Text() | ||
var lineArray []string = strings.Fields(line) | ||
var word string = lineArray[0] | ||
var code string = lineArray[1] | ||
|
||
for i, r := range code { | ||
if r == one { | ||
fmt.Print(strings.ToUpper(string(word[i]))) | ||
} else { | ||
fmt.Print(string(word[i])) | ||
} | ||
} | ||
fmt.Println() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1 Go Aug 03, 2015 Solved 100 1 4096 yes 34.995 Share on LinkedIn DELETE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
hello 11001 | ||
world 10000 | ||
cba 111 |