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 <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() {

entry:

  int n; cin >> n;
  if (!cin) return 0;
  if (n == 0) return 0;
  {
    char c;
    scanf("%c", &c);
  }

  while (n--) {
    for (int st = 0;;) {
      char c;
      scanf("%c", &c);
      if (c == '\n') break;
      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;
  }

  goto entry;

  return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
int main()
{
	bool flg = false;
	int n, i, c;
	string w, s;
	cin >> n;
	for (i = 0; i < n; i++)
	{
		c = 0;
		s = "";
		while (1)
		{
			flg = false;
			w = "";
			cin >> w;
			if (w.find(".", 0) != string::npos)
			{
				flg = true;
				w.erase(w.end()-1, w.end());
			}
			if (w.compare("Hoshino") == 0)
			{
				s += "Hoshina";
			}
			else							s += w;
			if (flg)
				s += ".";
			if (cin.get() == '\n') break;
			s += " ";
		}
		s.erase(s.end(), s.end());
		cout << s << endl;
	}
	return 0;
}

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

using namespace std;

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

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    int n;
    string s;
    cin >> n;
    getline(cin, s);
    rep(i, n)
    {
        getline(cin, s);
        while (s.find("Hoshino") != string::npos)
        {
            int a = s.find("Hoshino");
            s.replace(a, 7, "Hoshina");
        }
        OP(s);
    }
    return 0;
}

C++: #include <stdio.h>
#include <string.h>

int main(void){
    int datanum;
    char s[1001], *p;
    
    scanf("%d", &datanum);
    fgets(s,sizeof(s),stdin); // skip \n
    for (int i=0; i<datanum; i++){
        fgets(s,sizeof(s),stdin);
        while (p = strstr(s, "Hoshino")){
            p[6] = 'a';
        }
        printf("%s", s);
    }
    
    return 0;   
}

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

using namespace std;

int main(void)
{
	int n;
	string a;
	string g = "Hoshino";

	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, g.length(), "Hoshina");
		cout << a << endl;
	}
	
	return 0;
}

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

void convert(string& target, string before, string after) {
    while(target.find(before) != string::npos) {
        target.replace(target.find(before), before.length(), after);
    }
}

int main(void) {
    int num;
    cin >> num;
    cin.ignore();
    for(int r = 0; r < num; r++) {
        string input; getline(cin, input);
        convert(input, "Hoshino", "Hoshina");
        cout << input << endl;
    }
    return(0);
}

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

int main(){
	string s;
	int n;
	cin >> n;
	getchar();
	for (int i = 0; i < n; i++){
		getline(cin,s);
		while (1){
			int index = s.find("Hoshino");
			if (index == -1) break;
			s.replace(index,7,"Hoshina");
		}
		cout << s << endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
  int n,i;
  scanf("%d ",&n);
  while(n--){
    string s;
    for(getline(cin,s),i=0;i<s.size();i++){
      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]=='a')s[i+6]='o';
    }
    cout<<s<<endl;
  }
}

C++: #include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
int n;
using namespace std;
bool is_change(string& str,int pos, int len){
	const char A[] = {'H','o','s','h','i','n','a'};
	if(str.substr(pos,len) == "Hoshino"){
		for(int i=pos,j=0;i<pos+len,j<7;i++,j++){
			str[i] = A[j];
		}
		return true;
	}

	return false;
}
int main(){
	std::ios::sync_with_stdio(false);
	cin>>n;
	for(int i=0;i<n;i++){
		string str;
		for(int i=0;i+6<str.size();i++){
			if(is_change(str,i,7)){
				i+=6;
			}
		}
		cout<<str<<"\n";
	}
	return 0;
}

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

int main(){
	int n; // the number of datasets
	std::cin >> n;
	std::cin.ignore();

	for(int i = 0; i < n; ++i){
		std::string text;
		std::getline(std::cin, text); // input
		
		int text_size = text.size();
		int moji = 0;
		while(moji < text_size){
			moji = text.find("Hoshino", moji);
			text.replace(moji, 7, "Hoshina");
		}
		
		std::cout << text << std::endl; //output
	}

	return 0;
}

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

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

int main(void){

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

    string text,s,ret;
    string str = "Hoshino";
    string astr = "Hoshina";

    for(int i = 0; i < n; ++i) {
        getline(cin, text);
        ret = text;
        for(int j = 0; j < text.length()-6; ++j) {
            s = text.substr(j,str.length());
            if (s.compare(str) == 0) {
                ret = text.replace(j, astr.length(), astr);
                break;
            }

        }

        cout << "ans: " << ret << endl;
    }

}