Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	var n int
	fmt.Scanf("%d", &n)

	result := make([]string, n, n)

	for i := 0; i < n; i++ {
		scanner.Scan()
		input := scanner.Text()

		result[i] = strings.Replace(input, "Hoshino", "Hoshina", -1)
	}

	for _, v := range result {
		fmt.Println(v)
	}
}

C++: #include <stdio.h>
int main(){
    int n,now;
    char c;
    bool f;
    while(scanf("%d\n",&n)!=EOF){
        now=0;
        while(now<n){
            scanf("%c",&c);
            f=true;
            while(c=='H'){
                scanf("%c",&c);
                if(c=='o'){
                    scanf("%c",&c);
                    if(c=='s'){
                        scanf("%c",&c);
                        if(c=='h'){
                            scanf("%c",&c);
                            if(c=='i'){
                                scanf("%c",&c);
                                if(c=='n'){
                                    scanf("%c",&c);
                                    if(c=='o'){
                                        printf("Hoshina");
                                        f=false;
                                    }
                                    else printf("Hoshin");
                                }
                                else printf("Hoshi");
                            }
                            else printf("Hosh");
                        }
                        else printf("Hos");
                    }
                    else printf("Ho");
                }
                else printf("H");
            }
            if(f)printf("%c",c);
            if(c=='\n')now++;
        }
    }
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cassert>
#include <vector>
#include <string>
#include <cmath>
#include <map> 
#include <sstream>
using namespace std;
 
const int MAX= 10000100;

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()
#define ll long long int
#define gcd(a,b) __gcd(a,b)
#define pb(a) push_back(a)
int GCD(int a, int b) {if(!b) return a; return gcd(b, a%b);}
int lcm(int a, int b) {return a*b / gcd(a, b);}

int main(void){
  int n;
  string in;
  cin>>n;
  getline(cin,in);
  while(n--){
    string str;
    getline(cin,str);;
    if(str.size()<7){
      cout<<str<<endl;
      continue;
    }
    rep(i,str.size()-7){
      if(str[ i ] == 'H' && str[i+1] == 'o' && str[i+2] == 's' && str[i+3] == 'h' &&
	 str[i+4] == 'i' && str[i+5] == 'n' && str[i+6] == 'o'){
	str[i+6] = 'a';
      }
    }
    cout<<str<<endl;
  }

}

C++: #include <stdio.h>
#include <string.h>
char h[]="Hoshino";
int main(){
    int n,i;
    scanf("%d ",&n);
    for(i=0;i<n;i++){
        int j,l;
        char s[1001];
        gets(s);
        l=strlen(s);
        for(j=0;j<l-6;j++){
            int k=0;
            while(s[j+k]==h[k]){
                k++;
                if(k==7){
                    s[j+6]='a';
                    k=0;
                    break;
                }
            }
        }
        printf("%s\n",s);
    }
    return 0;
}

C++: #include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <numeric>
#include <ctype.h>
#include <cstdlib>
#include <string.h>
#include <cmath>
#include <cstdio>





using namespace std;


int main()
{
	int count;
	string input, _input;

	getline(cin, _input);

	count = stoi(_input);

	for (int i = 0; i < count; i++)
	{
		getline(cin, input);
	

		while (input.find("Hoshino") != string::npos)
		{
			input.replace(input.find("Hoshino"), 7 ,"Hoshina");
		}

		cout << input << endl;
	}

	



}

C++: #include<iostream>
#inlcude<string>
int main(){
	int a;
	std::cin>>a;
	for(int i=0;i<a+1;i++){
		std::string str;
		std::getline(std::cin,str);
		for(int j=0;j<str.size();j++){
			if(str[j]=='H'&&str[j+1]=='o'&&str[j+2]=='s'&&str[j+3]=='h'&&str[j+4]=='i'&&str[j+5]=='n'&&str[j+6]=='o'){
				str[j+6]='a';
			}
		}
		std::cout<<str<<std::endl;
	}
	
	return 0;
}

C++: #include <iostream>
#include <vector>
using namespace std;

int main(){
	int n;
	cin >> n;
	string s;
	getline(cin,s);
	while(n--){
		vector<int> b;
		getline(cin,s);
		int pos = 0;
		while(~s.find("Hoshino",pos)){
			pos = s.find("Hoshino",pos)+1;
			b.push_back(pos-1);
		}
		for(int i=0;i<b.size();i++)
			s.replace(b[i],7,"Hoshina");
		cout << s << endl;
	}
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <cstdio>

static void inputSentences(std::vector<std::string>& sentences, int n)
{
  fflush(stdin);
  for (int i = 0; i < n; i++) {
    std::string inputSentence;
    getline(std::cin, inputSentence);
    sentences.push_back(inputSentence);
  }
}

static void convertSentencesCore(const std::string& targetBase,
                                 const char afterConvert,
                                 int convertPos,
                                 std::vector<std::string>& sentences)
{
  for (std::vector<std::string>::iterator it = sentences.begin();
    it != sentences.end();
    ++it) {
    /* ?????¬ */
    if (*it == targetBase) {
      it->at(convertPos) = afterConvert;
      continue;
    }
    if (it->size() <= targetBase.size()) {
      continue;
    }
    while(true) {
      int find;
      std::string targetStr;
      bool findFlg = false;
      /* ?????? */
      targetStr = " " + targetBase + " ";
      find = it->find(targetStr);
      if (find != std::string::npos) {
        it->at(find + convertPos + 1) = afterConvert;
        findFlg = true;
      }
      /* ?????? */
      targetStr = targetBase + " ";
      find = it->find(targetStr);
      if (find == 0) {
        it->at(convertPos) = afterConvert;
        findFlg = true;
      }
      /* ????°? */
      targetStr = " " + targetBase;
      find = it->find(targetStr);
      if (find == it->size() - targetBase.size() - 1) {
        it->at(find + convertPos + 1) = afterConvert;
        findFlg = true;
      }
      if (findFlg == false) {
        break;
      }
    }
  }
}

static void convertSentences(std::vector<std::string>& sentences)
{
  convertSentencesCore("Hoshino", 'a', 6, sentences);
  convertSentencesCore("Hoshino,", 'a', 6, sentences);
  convertSentencesCore("Hoshino.", 'a', 6, sentences);
}

static void outputSentences(std::vector<std::string>& sentences)
{
  for (std::vector<std::string>::iterator it = sentences.begin();
    it != sentences.end();
    ++it) {
    std::cout << *it << std::endl;
  }
}

int main(void)
{
  int n;
  std::vector<std::string> sentences;

  std::cin >> n;

  inputSentences(sentences, n);
  convertSentences(sentences);
  outputSentences(sentences);

  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int n;
int main() {
cin>>n;

for (int i = 0; i < n; ++i) {
	string s;
	string a;
	cin.ignore();
	getline(cin,s);
	stringstream ss(s);
	string ret;
	bool b=false;
	while(!ss.eof()){
		ss>>ret;
		if(b)cout<<" ";
		b=true;
		if(ret=="Hoshino"){cout<<"Hoshina";}
		else{cout<<ret;}
	}cout<<endl;
}
}

C++: #include <iostream> 
#include <string> 
#include <vector> 
#include <cmath> 
#include <algorithm> 
#include <cstdlib> 

using namespace std;

int main()
{
	char n[10],str[2000];

	fgets(n,sizeof(n),stdin);

	for(int i=0;i<atoi(n);i++){
		fgets(str,sizeof(str),stdin);
		for(int j=0;str[j]!=NULL;j++){
			if(str[j]=='o' && j>=6){
				if(str[j-6]=='H'&&str[j-5]=='o'&&str[j-4]=='s'&&str[j-3]=='h'&&str[j-2]=='i'&&str[j-1]=='n') str[j]='a';
			}
		}
		cout<<str;
	}
	return 0;
}