Advertisement
Guest User

Untitled

a guest
Apr 19th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4. "fmt"
  5. "strings"
  6. )
  7.  
  8. func main() {
  9. a := input1()
  10. b := input2()
  11. n := len(a)
  12. result := []int{}
  13. for i := 0; i < n; i++ {
  14. if len(a[i]) != len(b[i]) {
  15. result = append(result, -1)
  16. }
  17.  
  18. for _, letter := range a[i] {
  19. b[i] = strings.Replace(b[i], string(letter), "", 1)
  20. }
  21. result = append(result, len(b[i]))
  22. fmt.Println(a[i], b[i], len(b[i]))
  23. }
  24.  
  25. fmt.Println(result)
  26. }
  27.  
  28. func input1() []string {
  29. return []string{
  30. "a",
  31. "abb",
  32. "kj",
  33. "tea",
  34. "okk",
  35. "op",
  36. "xxxy1",
  37. }
  38. }
  39.  
  40. func input2() []string {
  41. return []string{
  42. "bb",
  43. "abc",
  44. "jk",
  45. "toe",
  46. "koo",
  47. "mn",
  48. "xxxy2",
  49. }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement