Question: The output of this array shows a compilation error, if only the `a2.SumOfArray({12}, 12);` 
is commented, it compiles. How do I put it in an array form and get a working output?
Thank you.

```
import java.util.Scanner;
class Calculation
{

Scanner myScanner = new Scanner(System.in);
int total, I;

int SumOfArray(int data[], int size){

     System.out.print("Enter size of array: ");
     size = myScanner.nextInt();

         for(i=0; i<=size; i++){
             System.out.println("Enter number: ");
             data[i]=myScanner.nextInt();
             total=total+data[i];
         }

     System.out.println("Sum of Array: "+ total);
     return total;
 }

public class Main
{
    public static void main(String args[]){

        Calculation a2 = new Calculation();
        **a2.SumOfArray({12}, 12);**

    }
}

```

Answer: 
I am not a GO developer, but a single Regular Expression pattern for what you have shown would be:

---

```
(In(c|C)(\.|orp(\.|a\.|oration)))$

```

UPDATE: Found the GO way. 

---

```
package main

import (
    "fmt"
    "regexp"
)

func main() {

    re := regexp.MustCompile(`(?i)^(.*)(?:Inc(?:\.|orp(?:\.|a|oration)??\.))(.*)$`)

    fmt.Println(re.ReplaceAllString("ABC Inc.", "${1}Inc${2}"))
    fmt.Println(re.ReplaceAllString("ABC Incorp.", "${1}Inc${2}"))
    fmt.Println(re.ReplaceAllString("ABC InCorporation.", "${1}Inc${2}"))
    fmt.Println(re.ReplaceAllString("ABC InCorpa.", "${1}Inc${2}"))

}

```

---

```
ABC Inc
ABC Inc
ABC Inc
ABC Inc

```
If all you 'search & replace' are done on whole words, you can simply turn your `string` into a slice of words and construct a new `string` which replaces each word present in your `map` with its counterpart:

```
var buffer bytes.Buffer
for _, word := range words {
    if val, ok := patterns[word]; ok {
        word = val
    }
    buffer.WriteString(word)
    buffer.WriteString(" ")
} 

```