Advertisement
mjunolainen

Untitled

Jul 21st, 2021
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.51 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4.     "os"
  5.  
  6.     "github.com/01-edu/z01"
  7. )
  8.  
  9. func main() {
  10.     input := os.Args[1:]
  11.     if len(input) == 3 {
  12.         inputText := input[0]
  13.         inputTextRune := []rune(inputText)
  14.         firstArg := input[1]
  15.         firstArgRune := []rune(firstArg)
  16.         secondArg := input[2]
  17.         secondArgRune := []rune(secondArg)
  18.  
  19.         for i := 0; i < len(inputTextRune); i++ {
  20.             if inputTextRune[i] == firstArgRune[0] {
  21.                 inputTextRune[i] = secondArgRune[0]
  22.             }
  23.         }
  24.         for _, val := range inputTextRune {
  25.             z01.PrintRune(val)
  26.         }
  27.     }
  28.     z01.PrintRune('\n')
  29. }
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement