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 <iostream>
#include <string>
using namespace std;

int main(void)
{

	string instr;
	int N;

	cin >> N;

	cin.get();	//改行無視るための一文字読み込み関数（今回は()の中は何も書かない）
	for(int i = 0; i < N; i++){
		getline(cin, instr);
		for(int i = 0; i < instr.length(); i++){
			if(instr.substr(i, 7) == "Hoshino"){
				instr[i+6] = 'a';
				i += 5;
			}
		}
		cout << instr << endl;
	}

	return 0;
}

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

#define iota(i,n,b,s) for(int i=int(b);i!=int((b)+(s)*(n));i+=(s))
#define range(i,n,m) iota(i,(((n)>(m))?((n)-(m)+1):((m)-(n)+1)),(n),((n)>(m)?-1:1))
#define rep(i,n) iota(i,(n),0,1)

#define INF (1e9)
#define EPS (1e-9)
#define cons(a,b) (make_pair(a,b))
#define car(a) (a.first)
#define cdr(a) (a.second)
#define cadr(a) (car(cdr(a)))
#define cddr(a) (cdr(cdr(a)))
#define all(a) a.begin(), a.end()
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;

typedef long long Integer;
typedef double Real;

template<class S, class T>
ostream& operator<<(ostream& os, pair<S,T> p) {
  os << '(' << car(p) << ", " << cdr(p) << ')';
  return os;
}

template<class T>
ostream& operator<<(ostream& os, vector<T> v) {
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

int dx[] = { -1, 0, 1, 0 };
int dy[] = {  0, -1, 0, 1 };

int main() {

  int n; cin >> n;
  getchar();

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

    for (int i = 0, st = 0; i < s.size(); ++i) {
      char c = s[i];
      if (st == 0 && c == 'H') st = 1;
      else if (st == 1 && c == 'o') st = 2;
      else if (st == 2 && c == 's') st = 3;
      else if (st == 3 && c == 'h') st = 4;
      else if (st == 4 && c == 'i') st = 5;
      else if (st == 5 && c == 'n') st = 6;
      else if (st == 6 && c == 'o') st = 7;
      else st = 0;

      if (st == 7) {
        st = 0;
        cout << 'a';
      }
      else {
        cout << c;
      }
    }
    cout << endl;
  }

  return 0;
}

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

int main(){
	int n;
	string line;
	scanf("%d ",&n);
	
	for(int x=0;x<n;x++){
		getline(cin,line);
		while (line.find("Hoshino") != string::npos) {
			line.replace(line.find("Hoshino"), 7, "Hoshina");
		}
		cout << line << endl;
    }
	return 0;
}

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

int main(){
  int n;
  char c;
  int f;

  cin >> n;
  getchar();

  f = 0;
  while(n){
    c = getchar();
    
    if(f == 1){
      if(c == 'o')f++;
      else f = 0;
    }else if(f == 2){
      if(c == 's')f++;
      else f = 0;
    }else if(f == 3){
      if(c == 'h')f++;
      else f = 0;
    }else if(f == 4){
      if(c == 'i')f++;
      else f = 0;
    }else if(f == 5){
      if(c == 'n')f++;
      else f = 0;
    }else if(f == 6){
      if(c == 'o'){
	putchar('a');
	f++;
      }else f = 0;
    }

    if(c == 'H')f = 1;

    if(c == '\n')n--;

    if(f==7)f = 0;
    else putchar(c);
  }
}

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

int main(void){
	std::string tmp;
	u_int n; //number of data set

	std::cin >> n; //input number of data set
	std::cin.ignore(); //delete cin buffer

	for(size_t i = 0; i < n; ++i){
		std::vector<std::string> str; //string data
		std::string buf;

		std::getline(std::cin, buf); //input line
		std::istringstream is(buf);

		while(is >> tmp){ //input word
			if(tmp == "Hoshino"){ //judge word
				tmp = "Hoshina";
			}
			str.push_back(tmp); //add word to list
		}

		//output line
		for(std::vector<std::string>::iterator it = str.begin(); it != str.end(); ++it){
        	if(it == (str.end() - 1)){
           		std::cout << *it << std::endl;
        	}else{
        		std::cout << *it << " ";
        	}
        }
	}

	return 0;
}

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

int main(){
	int num;
	std::string english;
	std::cin >> num;

	for(int i=0;i<num;i++){
		std::cin >> english;
		while(english.find("Hoshino") != -1){
			int find = english.find("Hoshino");
			english.replace(find, find+6, "Hoshina");
		}
		std::cout << english;
	}
    return 0;
}

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

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

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

int main()
{
    string str[1099];
    string s;
    int test,k;
    char ch;

    cin>>test;
    cin.ignore();

    while(test--)
    {
        k=0;
        while(cin>>s)
        {
            if(s==" ")
                continue;

            str[k]=s;
            ch=getchar();
            if(ch=='\n')
                break;
            k++;
        }

        for(int i=0; i<=k; i++)
        {
            if(str[i]=="Hoshino")
                str[i]="Hoshina";
        }

        for(int i=0;i<=k;i++)
            cout<<str[i]<<" ";
        cout<<endl;

       // memset(str,'\0',sizeof(str));
    }
    return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <string>
using namespace std;

int main(){
	int n, j;
	cin >> n;
	char s[1001];
	gets(s);
	for (int i = 0; i < n; i++) {
		//string s;
		//cin >> s;
		gets(s);
		for (j = 0; j < 1000-6; j++) {
			if (s[j + 6] == 0)
				break;
			if (s[j] == 'H'&&s[j + 1] == 'o'&&s[j + 2] == 's'&&s[j + 3] == 'h'&&s[j + 4] == 'i'&&s[j + 5] == 'n'&&s[j + 6] == 'o')
				s[j + 6] = 'a';
		}
		cout << s << endl;
		for (j += 5; j >= 0; j--) {
			s[j] = 0;
		}
	}
	

}

C++: #include <stack>
#include <queue>
#include <cstdlib>
#include <iomanip>
#include <utility>
#include <math.h>
#include <vector>
#include <algorithm>
#include <string>
#include <iostream>

using namespace std;

int ssearch(string s, string p, string r)
{
    unsigned long sl = s.size();
    unsigned long pl=p.size();
    for(int i = 0; i< sl-pl+1;i++)
    {
        bool ch = true;
        for(int j = 0; j < pl;j++)
        {
            if(s[i] != p[j])
            {
                ch = false;
                break;
            }
        }
        if(ch)
        {
            for(int k = 0; k < pl; k++)
            {
                s[i+k] = r[k];
            }
            i+=pl;
        }
    }
    return 0;
}

int main() {
    
    int n;
    string str;
    getline(cin,str);
    n = atoi(str.c_str());
    for(int t = 0;t<n;t++)
    {

        getline(cin,str);
        ssearch(str,"Hoshino","Hoshina");
        cout << str << endl;
    }

    return 0;
}

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

const string check = "Hoshino";

int main()
{
	int n;
	string str;
	cin >> n;
	getline(cin,str);
	for(int loop=0;loop<n;loop++){
		getline(cin,str);
		for(unsigned i=0;i<str.size();i++){
			bool flag = true;
			for(unsigned j=0;j<check.size();j++){
				if(i+j < str.size()){
					if(str[i+j] != check[j])
						flag = false;
					else{
						if(j == check.size()-1 && flag)
							str[i+j] = 'a';
					}
				}
			}
		}
		cout << str << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

int main() {
  int n;
  cin >> n;
  cin.ignore();
  while(n--) {
    string line;
    getline(cin,line);
    REP(i,line.length()-6) {
      if (line.substr(i,7) == "Hoshino")
        line.replace(i,7,"Hoshina");
    }
    cout << line << endl;
  }
}