Go: package main

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

func main() {
	stdin := bufio.NewScanner(os.Stdin)
	stdin.Scan()
	n, _ := strconv.Atoi(stdin.Text())

	for i := 0; i < n; i++ {
		stdin.Scan()
		fmt.Println(strings.Replace(stdin.Text(), "Hoshino", "Hoshina", -1))
	}
}

C++: #include<stdio.h>
int main(){
    int i,j,n,flag=0;
    char a[1000]={0};
 
    scanf("%d%*c",&n);
    for(j=0;j<n;j++){
        flag=0;
        for(j=0;;j++){
      scanf("%c", &a[j]);
      if(a[j]=='\n'){
    a[j]='\0';
    
    break;
      }
    }

        for(i=0;a[i]!=0;i++){
            //printf("%d ",flag);
            if(flag==0){
                if(a[i]=='H')flag++;
            }
            else if(flag==1){
                if(a[i]=='o')flag++;
                else if(a[i]=='H')flag=1;
                else flag=0;
            }
            else if(flag==2){
                if(a[i]=='s')flag++;
                else if(a[i]=='H')flag=1;
                else flag=0;
            }
            else if(flag==3){
                if(a[i]=='h')flag++;
                else if(a[i]=='H')flag=1;
                else flag=0;
            }
            else if(flag==4){
                if(a[i]=='i')flag++;
                else if(a[i]=='H')flag=1;
                else flag=0;
            }
            else if(flag==5){
                if(a[i]=='n')flag++;
                else if(a[i]=='H')flag=1;
                else flag=0;
            }
            else if(flag==6){
                if(a[i]=='o')a[i]='a';
                else if(a[i]=='H')flag=1;
                else flag=0;
            }
        }
        for(i=0;a[i]!=0;i++)printf("%c",a[i]);puts("");
        for(i=0;a[i]!=0;i++)a[i]=0;
    }
    return 0;
}

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

int main(){
	std::string str;
	int num;
	int start = 0;

	std::cin >> num;

	getline(std::cin, str); // skip "\n"

	for(int i=0; i<num; ++i){

		std::getline(std::cin, str);

		while(start != -1){

			if(start == 0){ // for first loop
				start = (int)str.find("Hoshino", start);
			}else{
				start = (int)str.find("Hoshino", start+8);
			}

			if(start != -1){ // for first loop
				str.replace(start, 7, "Hoshina");
			}

		}

		std::cout << str << std::endl;

		start = 0;
	}

}

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

int n;
std::string str[3];

void reserve(std::string& ss, const std::string str1, const std::string str2) {
	for (int i = 0; i < ss.size() - str1.size() + 1; ++i) {
		std::string s;
		for (int j = i; j < i + str1.size(); ++j)
			s += ss[j];
		if (s == str1) {
			for (int j = i; j < i + str1.size(); ++j)
				ss[j] = str2[j - i];
		}
	}
}

int main() {
	std::cin >> n;
	for (int i = 0; i < 3; ++i)
		std::getline(std::cin, str[i]);
	for (int i = 0; i < 3; ++i)
		reserve(str[i], "Hoshino", "Hoshina");
	for (int i = 0; i < 3; ++i)
		std::cout << str[i] << std::endl;

	return 0;
}

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

using namespace std;

int main(void){
	int n;
	string str;
	cin >> n;
	cin.get();
	for(int i = 0;i < n;i++){
		getline(cin,str);
		while(str.find("Hoshino") != string::npos){
			int lc = str.find("Hoshino");
			lc += 6;
			str[lc] = 'a';
		}
		cout << str << endl;
	}
	return 0;
}

C++: //#include <bits/c++.h>
#include <iostream>
#include <cstdio>
#define rep(i,n) for(int i = 0; i< n; i++)
#define MAX_SIZE 1010

using namespace std;

int main(){
	
	int n;
	cin >> n;
//	cout << n << endl;
	for(int j = 0; j<=n; j++)
	{
	
		char s[MAX_SIZE] = {};
		gets(s);
		int i = 0;
		while(*(s+i) != '\0')
		{
			//printf("%c",*(s+i));
	         	bool check = true;
			if(*(s+i) == 'H')
		         if(*(s+i+1) == 'o')
			   if(*(s+i+2) =='s' )	
				if(*(s+i+3) =='h' )
					if(*(s+i+4) == 'i')
						if(*(s+i+5) == 'n' )
						if(*(s+i+6) == 'o')
						{
							cout << "Hoshina";
							i+=7;
							check = false;
						} 
		 if(*(s+i) != 'H' || check  == true)
		{
			printf("%c",*(s+i));
			i++;
		}
			
		}	
		 if(j)cout << endl;
	}
	if(j == false)
		cout << endl;  
	return 0;

}

C++: #include<bits/stdc++.h>
using namespace std;

int main(){
  int n;
  string key="Hoshino";
  cin>>n;cin.ignore();
  for(int i=0;i<n;i++){
    string str;
    int j=0,k=0;
    getline(cin,str);
    while(str[j]!=0){
      if(key[k]==str[j])k++;
      else k=0;
      if(k==7){
	if(str[j+1]==' ' || str[j+1]==0){
	str[j]='a';
	}
	k=0;
      }
      j++;
    }
    cout<<str<<endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>

#define loop(v, f, l) for(int v = (f), v##_ = (l); v < v##_; ++v)

using namespace std;

typedef long long int lint;
static inline int in(){ int x; scanf("%d", &x); return (x); }
static inline lint inl(){ lint x; scanf("%lld", &x); return (x); }

vector<string> split(const string& input)
{
	istringstream stream(input);

	string field;
	vector<string> result;
	while( std::getline(stream, field, ' ') )
	{
		result.push_back(field);
	}
	return result;
}

int main()
{
	int n;

	scanf("%d\n", &n);
	loop(i, 0, n)
	{
		string line;
		std::getline(cin, line);
		
		vector<string> words = split(line);
		for(vector<string>::iterator it = words.begin(); it != words.end(); it++)
		{
			string showStr = *it;
			int findPos = 0;
			if( (findPos = showStr.find("Hoshino")) != string::npos )
			{
				showStr.replace(findPos, 7, "Hoshina");
			}
			printf("%s ", showStr.c_str());
		}
		cout << endl;
	}
	return (0);
}

C++: #include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;
#define INF 100000000
#define SIZE 6 // Hoshinaの文字数-1
typedef long long ll;

int main(void) {
    int n;
    scanf(" %d ", &n);
    for (int i = 0; i < n; i++) {
        string s;
        getline(cin, s);
        while (1) {
            string::size_type index = s.find("Hoshino");
            if (index == string::npos) break;
            else s[index + SIZE] = 'a';
        }
        cout << s << endl;
    }
    return 0;
}

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

using namespace std;

int main() {
	int n; scanf("%d\n", &n);

	string rect = "Hoshino";

	for (int t = 0; t < n; ++t) {
		char c; int pos = 0;
		while ((c = getchar()) != EOF) {
			if (c != rect[pos]) pos = c == rect[0];
			else if (++pos == rect.size()) pos = 0, c = 'a';
			cout << c;
		}
	}
}

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

int main(){

	const std::string correct_word = "Hoshina";
	const std::string find_word = "Hoshino";
	std::string str;
	
	while(std::cin >> str){

		std::string::size_type pos = str.find("Hoshino");
		
		while(pos != std::string::nops){
			 str.replace(pos, find_word.length(), correct_word);
			 pos = str.find(find_word, pos + find_word.length());
		}
	
	std::cout << str << std::endl;
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <sstream>

using namespace std;

int main()
{
    int n;
    cin >> n;
    cin.ignore();

    while (n--) {
        string str;
        getline(cin, str);

        size_t pos = 0;
        while ((pos = str.find("Hoshino", pos)) != string::npos) {
            str.replace(pos, 7, "Hoshina");
        }

        cout << str << endl;
    }

    return 0;
}

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

using namespace std;

int main(void)
{
	int n;
	string a;

	cin >> n;
	cin.ignore();

	for (int i = 0; i < n; ++i){
		int x = 0;
		getline(cin, a);
		if ((x = a.find("Hoshino")) >= 0)
			a.replace(x, strlen("Hoshino"), "Hoshina");
		cout << a << endl;
	}
	
	return 0;
}