buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
#include <cctype> #include <cstdio> #include <cstring> #include <iostream> using namespace std; int main() { char s[200]; char p[100]; char c[100]; scanf("%S %s", s, p); strcpy(c, s); strcat(s, c); if (strstr(s, p) == NULL) { printf("No\n"); } else { printf("Yes\n"); } return 0; }
#include <cctype> #include <cstdio> #include <cstring> #include <iostream> using namespace std; int main() { char s[200]; char p[100]; char c[100]; scanf("%s %s", s, p); strcpy(c, s); strcat(s, c); if (strstr(s, p) == NULL) { printf("No\n"); } else { printf("Yes\n"); } return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
96
#include <iostream> using namespace std; int main() { string s, t; cin >> s >> t; s += s; cout << (s.find(t) ? "Yes" : "No") << endl; return 0; }
#include <iostream> using namespace std; int main() { string s, t; cin >> s >> t; s += s; cout << (s.find(t) != string::npos ? "Yes" : "No") << endl; return 0; }
[["+", 31, 16, 12, 23, 0, 41, 15, 16, 17, 79], ["+", 12, 23, 0, 41, 15, 16, 12, 343, 345, 348], ["+", 12, 23, 0, 41, 15, 16, 12, 343, 0, 349], ["+", 12, 23, 0, 41, 15, 16, 12, 343, 141, 22]]
1
51
/* * Ring.cpp * * Created on: 2014/07/27 * Author: WanWan1985 */ #include <iostream> #include <string> using namespace std; int main(void) { string strS; getline(cin, strS); strS += strS; string strP; getline(cin, strP); if (strS.find(strP) == string::npos) { cout << "NO" << endl; } els...
/* * Ring.cpp * * Created on: 2014/07/27 * Author: WanWan1985 */ #include <iostream> #include <string> using namespace std; int main(void) { string strS; getline(cin, strS); strS += strS; string strP; getline(cin, strP); if (strS.find(strP) == string::npos) { cout << "No" << endl; } els...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
77
#include <cstring> #include <iostream> #include <string> using namespace std; int main() { char c[201], c2[101], c3[101]; cin >> c >> c2; strcpy(c2, c); strcat(c, c2); if (strstr(c, c3) == NULL) cout << "No" << endl; else cout << "Yes" << endl; return 0; }
#include <cstring> #include <iostream> #include <string> using namespace std; int main() { char c[201], c2[101], c3[101]; cin >> c >> c3; strcpy(c2, c); strcat(c, c2); if (strstr(c, c3) == NULL) cout << "No" << endl; else cout << "Yes" << endl; return 0; }
[["-", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22]]
1
83
#include <cctype> #include <iostream> #include <string> using namespace std; int main() { // s=long p=short string s, p; int answer = 0; cin >> s; cin >> p; int lenp, lens; lenp = p.size(); lens = s.size(); // check if p[0]~p[lenp-1] = s[i]~s[i+lenp-1] or s[i]~s[i+lenp-lens-1] for (int i = 0; i < le...
#include <cctype> #include <iostream> #include <string> using namespace std; int main() { // s=long p=short string s, p; int answer = 0; cin >> s; cin >> p; int lenp, lens; lenp = p.size(); lens = s.size(); // check if p[0]~p[lenp-1] = s[i]~s[i+lenp-1] or s[i]~s[i+lenp-lens-1] for (int i = 0; i < le...
[["-", 51, 16, 31, 69, 341, 342, 0, 16, 17, 33], ["-", 51, 16, 31, 69, 341, 342, 0, 16, 12, 13], ["-", 31, 16, 31, 69, 341, 342, 0, 16, 17, 33], ["-", 31, 16, 31, 69, 341, 342, 0, 16, 12, 13]]
1
305
#include <iostream> #include <string> using namespace std; void init(string *s, string *p, int *s_len, int *p_len, string *buf) { cin >> *s; cin >> *p; *s_len = s->length(); *p_len = p->length(); buf->erase(); } int main() { string s; string p; string buf; int s_len; int p_len; int buf_len = 0;...
#include <iostream> #include <string> using namespace std; void init(string *s, string *p, int *s_len, int *p_len, string *buf) { cin >> *s; cin >> *p; *s_len = s->length(); *p_len = p->length(); buf->erase(); } int main() { string s; string p; string buf; int s_len; int p_len; int buf_len = 0;...
[["-", 8, 9, 0, 57, 15, 339, 51, 11, 17, 32], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60]]
1
220
#include <iostream> #include <string> using namespace std; int main() { string s, p; cin >> s; cin >> p; string t = s + s.substr(0, p.size()); unsigned int loc = t.find(p, 0); if (loc != string::npos) cout << "Yes" << endl; else cout << "No" << endl; return 0; }
#include <iostream> #include <string> using namespace std; int main() { string s, p; cin >> s; cin >> p; string t = s + s.substr(0, p.size()); // cout << t << endl; string::size_type loc = t.find(p, 0); if (loc != string::npos) cout << "Yes" << endl; else cout << "No" << endl; return 0; }
[["-", 0, 14, 8, 9, 0, 43, 39, 86, 0, 87], ["-", 0, 14, 8, 9, 0, 43, 39, 86, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 343, 345, 348], ["+", 0, 14, 8, 9, 0, 43, 39, 343, 0, 349], ["+", 0, 14, 8, 9, 0, 43, 39, 343, 141, 78]]
1
86
#include <algorithm> #include <cstdio> #include <iostream> #include <math.h> #include <vector> using namespace std; typedef long long ll; int main() { string str, key; cin >> str; str += str; bool ans = false; for (int i = 0; i < str.size(); ++i) { bool f = true; for (int j = 0; j < key.size(); ++j...
#include <algorithm> #include <cstdio> #include <iostream> #include <math.h> #include <vector> using namespace std; typedef long long ll; int main() { string str, key; cin >> str >> key; str += str; bool ans = false; for (int i = 0; i < str.size(); ++i) { bool f = true; for (int j = 0; j < key.size...
[["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22]]
1
163
#include <iostream> #include <string> using namespace std; int main() { string s, p; getline(cin, s); getline(cin, p); s = s + s; if (s.find(p) == string::npos) { cout << "no" << endl; } else { cout << "yes" << endl; } return 0; }
#include <iostream> #include <string> using namespace std; int main() { string s, p; getline(cin, s); getline(cin, p); s = s + s; if (s.find(p) == string::npos) { cout << "No" << endl; } else { cout << "Yes" << endl; } return 0; }
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
76
#include <cstdio> #include <cstring> #define LINE_NUM 1 int main() { char ring[101], p[101], line[LINE_NUM * 101]; scanf("%s", ring); scanf("%s", p); int ring_length, p_length; ring_length = strlen(ring); p_length = strlen(p); for (int i = 0; i < LINE_NUM; i++) { strcpy((line + i * (ring_length)), ...
#include <cstdio> #include <cstring> #define LINE_NUM 2 int main() { char ring[101], p[101], line[LINE_NUM * 101]; scanf("%s", ring); scanf("%s", p); int ring_length, p_length; ring_length = strlen(ring); p_length = strlen(p); for (int i = 0; i < LINE_NUM; i++) { strcpy((line + i * (ring_length)), ...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59]]
1
135
#include <iostream> #include <string> using namespace std; int main() { string s, p; string result = "No"; cin >> s; cin >> p; char c[200] = {}; for (int i = 0; i < sizeof(c) / sizeof(c[0]); i++) { c[i] = s[i % s.length()]; } for (int i = 0; i < sizeof(c) / sizeof(c[0]); i++) { int count ...
#include <iostream> #include <string> using namespace std; int main() { string s, p; string result = "No"; cin >> s; cin >> p; char c[200] = {}; for (int i = 0; i < sizeof(c) / sizeof(c[0]); i++) { c[i] = s[i % s.length()]; } for (int i = 0; i < sizeof(c) / sizeof(c[0]); i++) { int count ...
[["-", 0, 52, 15, 339, 51, 16, 31, 69, 28, 22], ["+", 0, 52, 15, 339, 51, 16, 31, 69, 28, 22], ["-", 15, 339, 51, 16, 31, 2, 63, 118, 28, 22], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 28, 22]]
1
164
import sys cnts = {} for line in imput(): for c in list(line.lower()): cnts[c] = cnts.get(c,0) + 1 for c in range(ord('a'),ord('z')+1): print(chr(c),':',cnts.get(chr(c),0))
import sys cnts = {} for line in sys.stdin: for c in list(line.lower()): cnts[c] = cnts.get(c,0) + 1 for c in range(ord('a'),ord('z')+1): print(chr(c),':',cnts.get(chr(c),0))
[["-", 36, 36, 0, 656, 0, 7, 12, 652, 63, 22], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 25], ["+", 36, 36, 0, 656, 0, 7, 12, 319, 500, 22], ["+", 36, 36, 0, 656, 0, 7, 12, 319, 0, 131], ["+", 36, 36, 0, 656, 0, 7, 12, 319, 319, 22]]
5
85
try: a="" while True: S=input() if not S: break S=S.lower() a=a+S except EOFError: pass for i in range(97,97+26): b=a.count(chr(i)) print(chr(i)+": "+str(b))
try: a="" while True: S=input() if not S: break S=S.lower() a=a+S except EOFError: pass for i in range(97,97+26): b=a.count(chr(i)) print(chr(i)+" : "+str(b))
[["-", 3, 4, 0, 657, 31, 657, 12, 557, 0, 6], ["+", 3, 4, 0, 657, 31, 657, 12, 557, 0, 6]]
5
74
import sys cs = { c : 0 for c in list("abcdefghijklmnopqrstuvwxyz")} for c in list(sys.stdin.read()): c = c.lower() if c in cs.keys(): cs[c] = cs[c] + 1 for (c,cnt) in sorted(list(cs.items())): print('[0] : [1]'.format(c,cnt))
import sys cs = { c : 0 for c in list("abcdefghijklmnopqrstuvwxyz")} for c in list(sys.stdin.read()): c = c.lower() if c in cs.keys(): cs[c] = cs[c] + 1 for (c,cnt) in sorted(list(cs.items())): print('{0} : {1}'.format(c,cnt))
[["-", 3, 4, 0, 652, 63, 319, 500, 557, 0, 6], ["+", 3, 4, 0, 652, 63, 319, 500, 557, 0, 6]]
5
91
import sys Target = "" for line in sys.stdin: Target += line for i in range(26): print(chr(i + 97), ":", Target.count(chr(i + 97)))
import sys Target = "" for line in sys.stdin: Target += line for i in range(26): print(chr(i + 97), ":", Target.lower().count(chr(i + 97)))
[["+", 0, 652, 63, 319, 500, 652, 63, 319, 319, 22], ["+", 0, 652, 63, 319, 500, 652, 3, 4, 0, 24], ["+", 0, 652, 63, 319, 500, 652, 3, 4, 0, 25], ["+", 0, 652, 3, 4, 0, 652, 63, 319, 0, 131]]
5
49
import sys STRING = "" for line in sys.stdin: STRING += line CHRS = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',\ 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] for i in CHRS: print("%s : %d" % (i, STRING.count(i)))
import sys STRING = "" for line in sys.stdin: STRING += line.lower() CHRS = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',\ 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] for i in CHRS: print("%s : %d" % (i, STRING.count(i)))
[["+", 0, 1, 0, 677, 12, 652, 63, 319, 0, 131], ["+", 0, 1, 0, 677, 12, 652, 63, 319, 319, 22], ["+", 0, 1, 0, 677, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 677, 12, 652, 3, 4, 0, 25]]
5
146
a="" while 1: try:InputText += input().lower() except:break [print(chr(97+i),':',a.count(chr(97+i)))for i in range(26)]
a="" while 1: try:a+=input().lower() except:break [print(chr(97+i),':',a.count(chr(97+i)))for i in range(26)]
[["-", 0, 246, 8, 196, 0, 1, 0, 677, 31, 22], ["+", 0, 246, 8, 196, 0, 1, 0, 677, 31, 22]]
5
55
import sys from collections import Counter m = Counter(sys.stdin.readlines().lower()) for i in 'abcdefghijklmnopqrstuvwxyz': print(i, ":", m[i])
import sys from collections import Counter m = Counter(sys.stdin.read().lower()) for i in 'abcdefghijklmnopqrstuvwxyz': print(i, ":", m[i])
[["-", 0, 652, 63, 319, 500, 652, 63, 319, 319, 22], ["+", 0, 652, 63, 319, 500, 652, 63, 319, 319, 22]]
5
42
import sys alist = list('abcdefghijklmnopqrstuvwxyz') r = {} for al in alist: r[al] = 0 line = sys.stdin.read().lower for i in range(len(line)): if line[i] in r.keys(): r[line[i]] += 1 for k,v in r.items(): print("{} : {}".format(k, v))
import sys alist = list('abcdefghijklmnopqrstuvwxyz') r = {} for al in alist: r[al] = 0 line = sys.stdin.read().lower() for i in range(len(line)): if line[i] in r.keys(): r[line[i]] += 1 for k,v in r.items(): print("{} : {}".format(k, v))
[["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
92
# -*- coding: utf-8 -*- import sys word = sys.stdin.read().lower() for i in range(ord('a'), ord('z') + 1): print('{0}:{1}'.format(chr(i), word.count(chr(i))))
# -*- coding: utf-8 -*- import sys word = sys.stdin.read().lower() for i in range(ord('a'), ord('z') + 1): print('{0} : {1}'.format(chr(i), word.count(chr(i))))
[["-", 3, 4, 0, 652, 63, 319, 500, 557, 0, 6], ["+", 3, 4, 0, 652, 63, 319, 500, 557, 0, 6]]
5
62
import sys cnt = {} for line in sys.stdin: for c in line: if c.isalpha(): cl = c.lower() cnt[cl] = cnt.get(c, 0) + 1 for i in range(97, 97 + 26): c = chr(i) print("{0} : {1}".format(c, cnt.get(c, 0)))
import sys cnt = {} for line in sys.stdin: for c in line: if c.isalpha(): cl = c.lower() cnt[cl] = cnt.get(cl, 0) + 1 for i in range(97, 97 + 26): c = chr(i) print("{0} : {1}".format(c, cnt.get(c, 0)))
[["-", 0, 662, 12, 657, 31, 652, 3, 4, 0, 22], ["+", 0, 662, 12, 657, 31, 652, 3, 4, 0, 22]]
5
85
# Counting Characters import sys charList = list('abcdefghijklmnopqrstuvwxyz') lines = sys.stdin.readlines() combinedLine = "" for line in lines: line = line.strip("\n") combinedLine += line totalSentence = list(combinedLine) # print(totalSentence) for char in charList: count = 0 for i in range(len(to...
# Counting Characters import sys charList = list('abcdefghijklmnopqrstuvwxyz') lines = sys.stdin.readlines() combinedLine = "" for line in lines: line = line.strip("\n").lower() combinedLine += line totalSentence = list(combinedLine) # print(totalSentence) for char in charList: count = 0 for i in rang...
[["+", 0, 1, 0, 662, 12, 652, 63, 319, 0, 131], ["+", 0, 1, 0, 662, 12, 652, 63, 319, 319, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
92
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String str = sc.nextLine(); String key = sc.nextLine(); String test = str + str; if (test.contains(key)) { System.out.println("Yse"); } else { System.out.pri...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String str = sc.nextLine(); String key = sc.nextLine(); String test = str + str; if (test.contains(key)) { System.out.println("Yes"); } else { System.out.pri...
[["-", 0, 1, 0, 492, 3, 4, 0, 5, 0, 491], ["+", 0, 1, 0, 492, 3, 4, 0, 5, 0, 491]]
3
102
import java.io.*; import java.lang.*; import java.util.*; class Main { public static void main(String[] args) throws IOException { Scanner scan = new Scanner(System.in); String s = scan.next(); String p = scan.next(); if (s.contains(p)) { System.out.println("Yes"); } else if (isSubString(s...
import java.io.*; import java.lang.*; import java.util.*; class Main { public static void main(String[] args) throws IOException { Scanner scan = new Scanner(System.in); String s = scan.next(); String p = scan.next(); if (s.contains(p)) { System.out.println("Yes"); } else if (isSubString(s...
[["-", 8, 196, 0, 7, 502, 503, 49, 200, 51, 499], ["+", 8, 196, 0, 7, 502, 503, 49, 200, 51, 499], ["-", 3, 4, 0, 492, 3, 4, 0, 16, 17, 33], ["-", 3, 4, 0, 492, 3, 4, 0, 16, 12, 499], ["-", 0, 57, 15, 15, 0, 492, 3, 4, 0, 21], ["-", 0, 57, 15, 15, 0, 492, 3, 4, 0, 499]]
3
209
#include <stdio.h> #include <string.h> int main() { char str[300], str1[101], str2[101]; scanf("%s", str1); scanf("%s", str2); strcpy(str, str2); strcat(str, str2); if (strstr(str, str2) == NULL) printf("No\n"); else printf("Yes\n"); }
#include <stdio.h> #include <string.h> int main() { char str[300], str1[101], str2[101]; scanf("%s", str1); scanf("%s", str2); strcpy(str, str1); strcat(str, str1); if (strstr(str, str2) == NULL) printf("No\n"); else printf("Yes\n"); }
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
0
86
#include <stdio.h> int main(void) { int i, len; char s[4096], p[4096], s2[4096]; scanf("%s", s); scanf("%s", p); //例 s="vanceknowledgetoad" //例 p="advance" // s2 = "vanceknowledgetoad" + "vanceknowledgetoad" sprintf(s2, "%s%s", s, s); // 文字列を連結する // strstr という関数で部分文字列を探す if (strstr(s2, p) == NULL...
#include <stdio.h> int main(void) { int i, len; char s[4096], p[4096], s2[4096]; scanf("%s", s); scanf("%s", p); //例 s="vanceknowledgetoad" //例 p="advance" // s2 = "vanceknowledgetoad" + "vanceknowledgetoad" sprintf(s2, "%s%s", s, s); // 文字列を連結する // strstr という関数で部分文字列を探す if (strstr(s2, p) == NULL...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
101
#include <stdio.h> #include <string.h> int main(void) { char str1[101], str2[101], str3[202]; scanf("%s", str1); strcpy(str3, str1); strcat(str3, str1); scanf(" %s", str2); if (strstr(str3, str2) == NULL) puts("NO"); else puts("YES"); return 0; }
#include <stdio.h> #include <string.h> int main(void) { char str1[101], str2[101], str3[202]; scanf("%s", str1); strcpy(str3, str1); strcat(str3, str1); scanf(" %s", str2); if (strstr(str3, str2) == NULL) puts("No"); else puts("Yes"); return 0; }
[["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
88
#include <stdio.h> #include <string.h> #define N 100 int main() { char str_base[N]; char str[N + 100]; char str_in[N]; scanf("%s", str_base); strcpy(str, str_base); strcat(str, str_base); scanf("%s", str_in); if (strstr(str, str_in) == NULL) { printf("No\n"); } else { printf("yes\n"); }...
#include <stdio.h> #include <string.h> #define N 100 int main() { char str_base[N]; char str[N + 100]; char str_in[N]; scanf("%s", str_base); strcpy(str, str_base); strcat(str, str_base); scanf("%s", str_in); if (strstr(str, str_in) == NULL) { printf("No\n"); } else { printf("Yes\n"); }...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
100
#include <stdio.h> #include <string.h> int main() { int i, j, len, lenp, flg; char s[203] = "", p[101] = ""; scanf("%s", s); strcat(p, s); strcat(s, p); scanf("%s", p); for (i = 0; i < strlen(s); i++) { flg = 1; for (j = 0; j < strlen(p); j++) { if (s[i + j] != p[j]) flg = 0; ...
#include <stdio.h> #include <string.h> int main() { int i, j, len, lenp, flg; char s[203] = "", p[101] = ""; scanf("%s", s); strcat(p, s); strcat(s, p); scanf("%s", p); for (i = 0; i < strlen(s) / 2; i++) { flg = 1; for (j = 0; j < strlen(p); j++) { if (s[i + j] != p[j]) { flg = 0; ...
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 85], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
0
168
#include <stdio.h> #include <string.h> char s[101], p[101]; int l_s, l_p, count = 0; void check(int num) { int i; count = 0; for (i = 0; i < l_p; i++) { if (num == l_s) { num = 0; } if (p[i] == s[num]) { // printf("%c\n",s[num]); count++; } else { break; } num++; ...
#include <stdio.h> #include <string.h> char s[128], p[128]; int l_s, l_p, count = 0; void check(int num) { int i; count = 0; for (i = 0; i < l_p; i++) { if (num == l_s) { num = 0; } if (p[i] == s[num]) { // printf("%c\n",s[num]); count++; } else { break; } num++; ...
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
218
#include <stdio.h> #include <string.h> int main() { char s[101], s_copy[101], p[101]; scanf("%s", &s); scanf("%s", &p); strcpy(s_copy, s); strcat(s, s_copy); if (strstr(s, p) != 0) { printf("YES\n"); } else { printf("NO\n"); } return 0; }
#include <stdio.h> #include <string.h> int main() { char s[101], s_copy[101], p[101]; scanf("%s", &s); scanf("%s", &p); strcpy(s_copy, s); strcat(s, s_copy); if (strstr(s, p) != 0) { printf("Yes\n"); } else { printf("No\n"); } return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
95
#include <stdio.h> #include <string.h> char ss[256]; char s[101]; char p[101]; char *x; char *endx; int i; main() { scanf("%s%s", &s, &p); strcpy(ss, s); strcat(ss, s); x = s; x = strstr(x, p); if (x) { printf("Yes\n"); } else { printf("No\n"); } return 0; }
#include <stdio.h> #include <string.h> char ss[256]; char s[101]; char p[101]; char *x; char *endx; int i; main() { scanf("%s%s", &s, &p); strcpy(ss, s); strcat(ss, s); x = ss; x = strstr(x, p); if (x) { printf("Yes\n"); } else { printf("No\n"); } return 0; }
[["-", 0, 30, 0, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 30, 0, 9, 0, 1, 0, 11, 12, 22]]
0
107
#include <stdio.h> #include <string.h> int main(void) { int lens, lenp, i, j, hante = 0; char s[101] = {'\0'}, p[101] = {'\0'}, sg[201] = {'\0'}; scanf("%s", s); scanf("%s", p); lens = strlen(s); lenp = strlen(p); strcat(sg, s); strcat(sg, s); for (i = 0; i < lens; i++) { for (j = 0; j < lenp; j+...
#include <stdio.h> #include <string.h> int main(void) { int lens, lenp, i, j, hante = 0; char s[101] = {'\0'}, p[101] = {'\0'}, sg[201] = {'\0'}; scanf("%s", s); scanf("%s", p); lens = strlen(s); lenp = strlen(p); strcat(sg, s); strcat(sg, s); for (i = 0; i < lens; i++) { for (j = 0; j < lenp; j+...
[["-", 15, 23, 0, 16, 12, 23, 0, 16, 17, 33], ["-", 15, 23, 0, 16, 12, 23, 0, 16, 12, 13]]
0
188
#include <stdio.h> #include <string.h> int main(void) { int lens, lenp, i, j, hante = 0; char s[101], p[101], buf[201]; scanf("%s", s); scanf("%s", p); lens = strlen(s); lenp = strlen(p); strcpy(buf, s); strcat(buf, s); for (i = 0; i < lens; i++) { for (j = 0; j < lenp; j++) { if (buf[i + j...
#include <stdio.h> #include <string.h> int main(void) { int lens, lenp, i, j, hante = 0; char s[101], p[101], buf[201]; scanf("%s", s); scanf("%s", p); lens = strlen(s); lenp = strlen(p); strcpy(buf, s); strcat(buf, s); for (i = 0; i < lens; i++) { for (j = 0; j < lenp; j++) { if (buf[i + j...
[["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
0
165
#include <stdio.h> int str_length(char[]); int main() { char p[100], s[100], p1[200]; gets(p); // scanf("%c \n %c",&s[],&p[]); gets(s); //??????identifier?????????????????? int len = str_length(p), i, j, f = 0; for (i = 0; i < len; i++) { p1[i] = p[i]; p1[i + len] = p[i]; } p1[len + len] = '\0'...
#include <stdio.h> int str_length(char[]); int main() { char p[100], s[100], p1[200]; gets(p); // scanf("%c \n %c",&s[],&p[]); gets(s); //??????identifier?????????????????? int len = str_length(p), i, j, f = 0; for (i = 0; i < len; i++) { p1[i] = p[i]; p1[i + len] = p[i]; } p1[len + len] = '\0'...
[["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
248
#include <stdio.h> int main(void) { char served[200]; char pick[100]; int i = 0; int j = 0; int k, l, cnt = 0; scanf("%s", served); scanf("%s", pick); while (1) { if (served[i++] == '\0') break; } while (1) { if (pick[j++] == '\0') break; } for (k = i - 1; k <= 2 * i - 3; ...
#include <stdio.h> int main(void) { char served[200]; char pick[100]; int i = 0; int j = 0; int k, l, cnt = 0; scanf("%s", served); scanf("%s", pick); while (1) { if (served[i++] == '\0') break; } while (1) { if (pick[j++] == '\0') break; } for (k = i - 1; k <= 2 * i - 3; ...
[["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
231
#include <ctype.h> #include <stdio.h> int main() { char s[100], p[100]; int i, j, k, zisuus, zisuup, hantei; scanf("%s", s); scanf("%s", p); zisuus = 0; while (s[zisuus]) { zisuus++; } zisuup = 0; while (p[zisuup]) { zisuup++; } for (i = 0; i < zisuus; i++) { /* i???s[]????§?????...
#include <ctype.h> #include <stdio.h> int main() { char s[100], p[100]; int i, j, k, zisuus, zisuup, hantei; scanf("%s", s); scanf("%s", p); zisuus = 0; while (s[zisuus]) { zisuus++; } zisuup = 0; while (p[zisuup]) { zisuup++; } for (i = 0; i < zisuus; i++) { /* i???s[]????§?????...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22]]
0
204
#include <stdio.h> #include <stdlib.h> #include <string.h> int s_length(const char s[]) { int len = 0; while (s[len]) len++; return len; } int main() { int n, i; char s[100], p[100], rings[200]; char *ret; scanf("%s", s); scanf("%s", p); n = s_length(s); for (i = 0; i < (n - 1); i++) { ...
#include <stdio.h> #include <stdlib.h> #include <string.h> int s_length(const char s[]) { int len = 0; while (s[len]) len++; return len; } int main() { int n, i; char s[100], p[100], rings[200]; char *ret; scanf("%s", s); scanf("%s", p); n = s_length(s); for (i = 0; i < n; i++) { rings...
[["-", 8, 9, 0, 7, 15, 16, 12, 23, 0, 24], ["-", 0, 7, 15, 16, 12, 23, 0, 16, 17, 33], ["-", 0, 7, 15, 16, 12, 23, 0, 16, 12, 13], ["-", 8, 9, 0, 7, 15, 16, 12, 23, 0, 25]]
0
171
#include <stdio.h> int s_length(const char s[]) { int len = 0; while (s[len]) len++; return len; } int main() { int n, i; char s[100], p[100], rings[200]; char *ret; scanf("%s", s); scanf("%s", p); n = s_length(s); for (i = 0; i < n - 1; i++) { rings[i] = s[i]; rings[i + n - 1] = s...
#include <stdio.h> int s_length(const char s[]) { int len = 0; while (s[len]) len++; return len; } int main() { int n, i; char s[100], p[100], rings[200]; char *ret; scanf("%s", s); scanf("%s", p); n = s_length(s); for (i = 0; i < n; i++) { rings[i] = s[i]; rings[i + n] = s[i]; }...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["-", 0, 1, 0, 11, 31, 69, 71, 16, 17, 33], ["-", 0, 1, 0, 11, 31, 69, 71, 16, 12, 13]]
0
167
#include <stdio.h> #include <string.h> int main() { char s[100]; char p[100]; char a[200]; scanf("%s", s); scanf("%s", p); strcpy(a, s); strcpy(a, s); if (strstr(a, p)) printf("Yes\n"); else printf("No\n"); return 0; }
#include <stdio.h> #include <string.h> int main() { char s[100]; char p[100]; char a[200]; scanf("%s", s); scanf("%s", p); strcpy(a, s); strcat(a, s); if (strstr(a, p)) printf("Yes\n"); else printf("No\n"); return 0; }
[["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22]]
0
89
#include <stdio.h> #include <string.h> int main() { char str_s[100], str_p[100], str_s2[202]; int i, j, flag; int s_len, p_len; gets(str_s); gets(str_p); s_len = strlen(str_s); p_len = strlen(str_p); sprintf(str_s2, "%s%s", str_s, str_s); for (i = 0; i < s_len; i++) { flag = 1; for (j = 0;...
#include <stdio.h> #include <string.h> int main() { char str_s[100], str_p[100], str_s2[200]; int i, j, flag; int s_len, p_len; gets(str_s); gets(str_p); s_len = strlen(str_s); p_len = strlen(str_p); sprintf(str_s2, "%s%s", str_s, str_s); for (i = 0; i < s_len; i++) { flag = 1; for (j = 0;...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
171
#include <stdio.h> #include <string.h> int main() { char s[100], p[100], s2[201]; scanf("%s", s); scanf("%s", p); strcat(s2, s); strcat(s2, s); if (strstr(s2, p) == '\0') printf("NO\n"); else printf("YES\n"); return 0; }
#include <stdio.h> #include <string.h> int main() { char s[100], p[100], s2[201]; scanf("%s", s); scanf("%s", p); strcat(s2, s); strcat(s2, s); if (strstr(s2, p) == '\0') printf("No\n"); else printf("Yes\n"); return 0; }
[["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
91
#include <stdio.h> #include <string.h> int main() { char s[102], sDouble[204], p[102]; char *presult; scanf("%s", s); strncpy(sDouble, s, sizeof(s) - 1); strncat(sDouble, s, (sizeof(s) / 2)); scanf("%s", p); presult = strstr(sDouble, p); (presult == NULL) ? printf("%s\n", "NO") : printf("%s\n", "YES"...
#include <stdio.h> #include <string.h> int main() { char s[102], sDouble[204], p[102]; char *presult; scanf("%s", s); strncpy(sDouble, s, sizeof(s) - 1); strncat(sDouble, s, (sizeof(s) / 2)); scanf("%s", p); presult = strstr(sDouble, p); (presult == NULL) ? printf("%s\n", "No") : printf("%s\n", "Yes"...
[["-", 0, 41, 64, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 41, 64, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 41, 75, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 41, 75, 2, 3, 4, 0, 5, 0, 6]]
0
120
#include <stdio.h> #include <string.h> int main(void) { int x = 0, l = 0, i = 0, k = 0, j = 0, w = 1, f = 0, o = 0; char s[250] = {0}, ss[250] = {0}, p[100] = {0}, er; // strcpy(??????????????????,????????????) // strcpy(??????????????????,????????????) scanf("%s", &s); strcpy(ss, s); strcat(s, ss); sca...
#include <stdio.h> #include <string.h> int main(void) { int x = 0, l = 0, i = 0, k = 0, j = 0, w = 1, f = 0, o = 0; char s[250] = {0}, ss[250] = {0}, p[100] = {0}, er; scanf("%s", &s); strcpy(ss, s); strcat(s, ss); scanf("%s", &p); if ((er = strstr(s, p)) != NULL) { printf("Yes\n"); } else { pri...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 14, 8, 9, 0, 57, 15, 23, 0, 24], ["+", 31, 23, 0, 11, 12, 2, 3, 4, 0, 25]]
0
147
#include <stdio.h> #include <string.h> int main(void) { char s[200]; char p[100]; int i, k, j = 0; scanf("%s", s); scanf("%s", p); k = strlen(s); for (i = k; i <= 2 * k; i++) { s[i] = s[i - k]; } if (strstr(s, p) != NULL) { printf("YES\n"); } else { printf("NO\n"); } return 0; }
#include <stdio.h> #include <string.h> int main(void) { char s[200]; char p[100]; int i, k, j = 0; scanf("%s", s); scanf("%s", p); k = strlen(s); for (i = k; i <= 2 * k; i++) { s[i] = s[i - k]; } if (strstr(s, p) != NULL) { printf("Yes\n"); } else { printf("No\n"); } return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
121
#include <stdio.h> int main(void) { char p[101], s[101]; int i = 0, j = 0, k = 0, a = 0, b = 0; int ans = 0; for (i = 0; i < 101; i++) { scanf("%c", &s[i]); if (s[i] == '\n') break; } for (j = 0; j < 101; j++) { scanf("%c", &p[j]); if (p[j] == '\n') break; } for (k = 0; k < i...
#include <stdio.h> int main(void) { char p[101], s[101]; int i = 0, j = 0, k = 0, a = 0, b = 0; int ans = 0; for (i = 0; i < 101; i++) { scanf("%c", &s[i]); if (s[i] == '\n') break; } for (j = 0; j < 101; j++) { scanf("%c", &p[j]); if (p[j] == '\n') break; } for (k = 0; k < i...
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 31, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 31, 22]]
0
238
#include <stdio.h> int main(void) { char s[100]; char p[100]; int count = 0; int i = 0; while (1) { scanf("%c", &s[count]); if (s[count] == '\n') { break; } count++; } int u[count * 3]; for (i = 0; i < count * 2; i++) { if (i < count) { u[i] = s[i]; } else if (i < co...
#include <stdio.h> int main(void) { char s[100]; char p[100]; int count = 0; int i = 0; while (1) { scanf("%c", &s[count]); if (s[count] == '\n') { break; } count++; } int u[count * 3]; for (i = 0; i < count * 2; i++) { if (i < count) { u[i] = s[i]; } else if (i < co...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
252
#include <stdio.h> #include <string.h> int main() { char s[210] = {}, p[100] = {}, task[100] = {}; scanf("%s", s); scanf("%s", p); strcpy(task, s); strcat(s, task); if (strstr(s, p) != "\0") { printf("Yes\n"); } else { printf("No\n"); } return 0; }
#include <stdio.h> #include <string.h> int main() { char s[200] = {}, p[100] = {}, task[101] = {}; //??£?????¨; scanf("%s", s); scanf("%s", p); strcpy(task, s); //?????????????????? strcat(s, task); //??°??¶????????¨???????????????????????? if (strstr(s, p) != 0) { printf("Yes\n"); } else { prin...
[["-", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["-", 0, 57, 15, 23, 0, 16, 12, 5, 0, 62], ["-", 0, 57, 15, 23, 0, 16, 12, 5, 0, 44], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13]]
0
104
until (number=gets)=="0" puts number.split("").map(&:to_i).inject(:+) end
until (number=gets.chomp)=="0" puts number.split("").map(&:to_i).inject(:+) end
[["+", 15, 738, 31, 739, 0, 662, 12, 652, 17, 131], ["+", 15, 738, 31, 739, 0, 662, 12, 652, 735, 22]]
4
30
until (number=gets)=="0" puts number.split("").map(&:to_i).inject(:+) end
until (number=gets.chomp)=="0"do puts number.split("").map(&:to_i).inject(:+) end
[["+", 15, 738, 31, 739, 0, 662, 12, 652, 17, 131], ["+", 15, 738, 31, 739, 0, 662, 12, 652, 735, 22], ["+", 36, 36, 0, 493, 0, 750, 8, 170, 0, 170]]
4
30
loop do x = gets.chomp break if x == "0" puts x.split.map(&:to_i).inject(&:+) end
loop do x = gets.chomp break if x == "0" puts x.split("").map(&:to_i).inject(&:+) end
[["+", 0, 652, 486, 652, 486, 652, 3, 4, 0, 24], ["+", 486, 652, 486, 652, 3, 4, 0, 557, 0, 62], ["+", 0, 652, 486, 652, 486, 652, 3, 4, 0, 25]]
4
31
while x = gets break if x == "0" sum = 0 x.split("").map{|a|sum += a.to_i} puts sum end
while x = gets.chomp break if x == "0" sum = 0 x.split("").map{|a|sum += a.to_i} puts sum end
[["+", 0, 493, 0, 89, 15, 662, 12, 652, 17, 131], ["+", 0, 493, 0, 89, 15, 662, 12, 652, 735, 22]]
4
36
while true do x = gets break if x == '0' i = 0 for c in x.chars i += c.to_i end puts i end
while true do x = gets.chomp break if x == '0' i = 0 for c in x.chars i += c.to_i end puts i end
[["+", 0, 89, 8, 170, 0, 662, 12, 652, 17, 131], ["+", 0, 89, 8, 170, 0, 662, 12, 652, 735, 22]]
4
31
while true x = gets.chomp break if x == 0 i = 0 for c in x.chars i += c.to_i end puts i end
while true x = gets.chomp break if x == '0' i = 0 for c in x.chars i += c.to_i end puts i end
[["+", 8, 170, 0, 751, 15, 738, 12, 557, 0, 62]]
4
30
while(x=gets)!="0" s=0 x.length.times{|i|s+=x[i].to_i} puts s end
while (x=gets)!="0\n" s=0 x.length.times{|i|s+=x[i].to_i} puts s end
[["+", 0, 493, 0, 89, 15, 738, 12, 557, 0, 44]]
4
34
loop { x = gets if x== '0' break else sum = 0 x.chars { |i| sum += i.to_i } puts sum end }
loop { x = gets.chomp if x == '0' break end sum = 0 x.chars { |i| sum += i.to_i } puts sum }
[["+", 196, 196, 8, 734, 0, 662, 12, 652, 17, 131], ["+", 196, 196, 8, 734, 0, 662, 12, 652, 735, 22], ["-", 196, 196, 8, 734, 0, 121, 75, 95, 0, 95], ["+", 0, 652, 196, 196, 8, 734, 0, 121, 0, 444], ["-", 0, 652, 196, 196, 8, 734, 0, 121, 0, 444]]
4
33
loop { x = gets.chomp break if x == '0' sum = 0 c.chars { |i| sum += i.to_i } puts sum }
loop { x = gets.chomp break if x == '0' sum = 0 x.chars { |i| sum += i.to_i } puts sum }
[["-", 0, 652, 196, 196, 8, 734, 0, 652, 486, 22], ["+", 0, 652, 196, 196, 8, 734, 0, 652, 486, 22]]
4
33
loop { x = gets if x== '0' break else sum = 0 x.chars { |i| sum += i.to_i } puts sum end }
loop { x = gets.chop x == '0' && break sum = 0 x.chars { |i| sum += i.to_i } puts sum }
[["-", 0, 652, 196, 196, 8, 734, 0, 121, 0, 121], ["+", 196, 196, 8, 734, 0, 662, 12, 652, 17, 131], ["+", 196, 196, 8, 734, 0, 662, 12, 652, 735, 22], ["+", 0, 652, 196, 196, 8, 734, 0, 738, 17, 98], ["-", 196, 196, 8, 734, 0, 121, 75, 95, 0, 95], ["-", 0, 652, 196, 196, 8, 734, 0, 121, 0, 444]]
4
33
while (n = gets.to_i) != 0 puts n.to_s.gets.split(" ").map(&:to_i).inject(:+) end
while (n = gets.to_i) != 0 puts n.to_s.split("").map(&:to_i).inject(:+) end
[["-", 0, 652, 486, 652, 486, 652, 486, 652, 735, 22], ["-", 3, 4, 0, 652, 486, 652, 486, 652, 17, 131], ["-", 486, 652, 486, 652, 3, 4, 0, 557, 0, 6]]
4
35
while True: s = input() if s == "0": break a = 0 for i in s: a += int(s[i]) print(a)
while True: s = input() if s == "0": break a = 0 for i,j in enumerate(s): a += int(s[i]) print(a)
[["+", 0, 52, 8, 196, 0, 7, 31, 684, 0, 21], ["+", 0, 52, 8, 196, 0, 7, 31, 684, 0, 22], ["+", 0, 52, 8, 196, 0, 7, 12, 652, 63, 22], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 24], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 25]]
5
37
a = True while a: l = map(int, list(input())) if l[0] != 0: print(sum(l)) else: a = False
a = True while a: l = list(map(int, list(input()))) if l[0] != 0: print(sum(l)) else: a = False
[["+", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
39
while True: table=str(input()) if table[0] == '0': break print(sum(int(num) for num in table(num)))
while True: table=str(input()) if table[0] == '0': break print(sum(int(num) for num in(table)))
[["-", 0, 652, 3, 668, 0, 659, 12, 652, 63, 22], ["-", 3, 668, 0, 659, 12, 652, 3, 4, 0, 22], ["+", 0, 652, 3, 668, 0, 659, 12, 23, 0, 22]]
5
39
go = 1 while go == 1: a = str(input()) alist = list(a) if a ==0: go = 0 exit sum = 0 for i in alist: i = int(i) sum += i if go == 1: print(sum)
go = 1 while go == 1: a = str(input()) alist = list(a) if a == "0": go = 0 exit sum = 0 for i in alist: i = int(i) sum += i if go == 1: print(sum)
[["+", 8, 196, 0, 57, 15, 666, 0, 557, 0, 654], ["+", 8, 196, 0, 57, 15, 666, 0, 557, 0, 655]]
5
57
while True: n = list(map(int,input())) if n[0] ==0: break else: print(n.sum())
while True: n = list(map(int,input())) if n[0] ==0: break else: print(sum(n))
[["-", 0, 652, 3, 4, 0, 652, 63, 319, 500, 22], ["-", 0, 652, 3, 4, 0, 652, 63, 319, 0, 131], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22]]
5
35
while True: num = input() if(num == 0): break ret = 0 for i in num: ret += int(i) print(ret)
while True: num = input() if(num == "0"): break ret = 0 for i in num: ret += int(i) print(ret)
[["+", 0, 57, 15, 23, 0, 666, 0, 557, 0, 654], ["+", 0, 57, 15, 23, 0, 666, 0, 557, 0, 655]]
5
34
x = list(map(int,list(input()))) if 0 != x[0]: print(sum(x))
while True: x = list(map(int,list(input()))) if 0 != x[0]: print(sum(x)) else: break
[["+", 36, 36, 36, 36, 0, 656, 0, 52, 0, 89], ["+", 36, 36, 36, 36, 0, 656, 0, 52, 15, 146], ["+", 36, 36, 36, 36, 0, 656, 0, 52, 0, 102], ["+", 0, 52, 8, 196, 0, 57, 75, 76, 0, 95], ["+", 0, 52, 8, 196, 0, 57, 75, 76, 0, 102], ["+", 0, 57, 75, 76, 8, 196, 0, 93, 0, 94]]
5
31
while True: n = input() if n=="0": break ans = 0 for x in range(len(n)-1): ans += int(n[x]) print(ans)
while True: n = input() if n=="0": break ans = 0 for x in range(len(n)): ans += int(n[x]) print(ans)
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
45
while True: a=str(input()) if a=="0": break sum([int(i) for i in a])
while True: a=str(input()) if a=="0": break print((sum([int(i) for i in a])))
[["+", 0, 52, 8, 196, 0, 1, 0, 652, 63, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 652, 3, 4, 0, 23, 0, 24], ["+", 3, 4, 0, 23, 0, 652, 3, 4, 0, 25], ["+", 0, 1, 0, 652, 3, 4, 0, 23, 0, 25]]
5
32
while 1: str = input() if(str == '0'): break print(sum([int(c) for c in list(input())]))
while 1: str = input() if(str == '0'): break print(sum([int(c) for c in list(str)]))
[["-", 0, 659, 12, 652, 3, 4, 0, 652, 63, 22], ["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25], ["+", 0, 658, 0, 659, 12, 652, 3, 4, 0, 22]]
5
39
while True: x = list(input()) if x == "0": break sum = 0 for i in range(len(x)): sum += int(x[i]) print(sum)
while True: x = list(input()) if x[0] == "0": break sum = 0 for i in range(len(x)): sum += int(x[i]) print(sum) #print(x)
[["+", 8, 196, 0, 57, 15, 666, 0, 206, 0, 70], ["+", 8, 196, 0, 57, 15, 666, 0, 206, 206, 612], ["+", 8, 196, 0, 57, 15, 666, 0, 206, 0, 73]]
5
46
while True: x=eval(input()) if x=='0': break print(sum(map(int,x)))
while True: x=input() if x=='0': break print(sum(map(int,x)))
[["-", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
31
while True: data = int(input()) if data == '0': break print(sum([str(i) for i in data]))
while True: data = input() if data == '0': break print(sum([int(i) for i in data]))
[["-", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25], ["-", 0, 652, 3, 4, 0, 658, 8, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 658, 8, 652, 63, 22]]
5
35
while 1: n = input() if int(n) == 0: break sum = 0 for i in range(n): sum += int(n[i]) print(sum)
while 1: n = input() if int(n) == 0: break sum = 0 for i in range(len(n)): sum += int(n[i]) print(sum)
[["+", 0, 7, 12, 652, 3, 4, 0, 652, 63, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
41
while True: x = input() if x == 0: quit() print(sum([int(_) for _ in str(x)]))
while True: x = input() if x == '0': quit() print(sum([int(_) for _ in x]))
[["+", 8, 196, 0, 57, 15, 666, 0, 557, 0, 654], ["+", 8, 196, 0, 57, 15, 666, 0, 557, 0, 655], ["-", 3, 4, 0, 658, 0, 659, 12, 652, 63, 22], ["-", 0, 658, 0, 659, 12, 652, 3, 4, 0, 24], ["-", 0, 658, 0, 659, 12, 652, 3, 4, 0, 25]]
5
35
while 1: x = input() if x[0] == 0: break print (sum(int(i)for i in x ))
while 1: x = input() if x[0] == "0": break print (sum(int(i)for i in x))
[["+", 8, 196, 0, 57, 15, 666, 0, 557, 0, 654], ["+", 8, 196, 0, 57, 15, 666, 0, 557, 0, 655]]
5
31
while True: x = input() if x == "0": break num = [int(i) for i in x.split("")] print(sum(num))
while True: x = input() if x == "0": break num = [int(i) for i in x] print(sum(num))
[["-", 12, 658, 0, 659, 12, 652, 63, 319, 0, 131], ["-", 12, 658, 0, 659, 12, 652, 63, 319, 319, 22], ["-", 12, 658, 0, 659, 12, 652, 3, 4, 0, 24], ["-", 0, 659, 12, 652, 3, 4, 0, 557, 0, 654], ["-", 0, 659, 12, 652, 3, 4, 0, 557, 0, 655], ["-", 12, 658, 0, 659, 12, 652, 3, 4, 0, 25]]
5
41
while 1: s = input() if s == '0': break print(sum(int(n)) for n in s)
while 1: s = input() if s == '0':break print(sum(int(n) for n in s))
[["-", 0, 652, 3, 668, 8, 652, 3, 4, 0, 25], ["+", 0, 652, 3, 4, 0, 652, 3, 668, 0, 25]]
5
30
while 1: x=[ int(i) for i in input()] if x==0: break print(sum(list(x)))
while 1: x=[int(i) for i in input()] if sum(x)==0: break print(sum(x))
[["+", 8, 196, 0, 57, 15, 666, 0, 652, 63, 22], ["+", 0, 57, 15, 666, 0, 652, 3, 4, 0, 24], ["+", 0, 57, 15, 666, 0, 652, 3, 4, 0, 25], ["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["-", 3, 4, 0, 652, 3, 4, 0, 652, 63, 22], ["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
33
x = 1 L=[] n= 0 s=0 while x is not 0: x = int(input()) L.append(x) N=1 L.remove(0) for i in L: while i >N: N=10*N n =i%N s+=(n/N*10) i-=n print (int(s)) s=0 N = 1
x = 1 L=[] n= 0 s=0 while x is not 0: x = int(input()) L.append(x) N=1 L.remove(0) for i in L: while i >=N: N=10*N n =i%N s+=(n/N*10) i-=n print (int(s)) s=0 N = 1
[["-", 0, 7, 8, 196, 0, 52, 15, 666, 667, 47], ["+", 0, 7, 8, 196, 0, 52, 15, 666, 667, 20]]
5
87
while True: x=input() if x==0: break print(sum(int(z) for z in x))
while True: x=input() if x == '0': break print(sum(int(z) for z in x))
[["+", 8, 196, 0, 57, 15, 666, 0, 557, 0, 654], ["+", 8, 196, 0, 57, 15, 666, 0, 557, 0, 655]]
5
28
list1 = [] result = 0 while True: x = str(input()) if x == '0': break else: for i in x: result += int(i) list1.append(result) for i in list1: print(i)
list1 = [] while True: x = str(input()) if x == '0': break else: result=0 for i in x: result += int(i) list1.append(result) for i in list1: print(i)
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 12, 612]]
5
54
a=0 while True: z=str(input()) if z == 0 : break for i in z: k=int(i) a+=k print(a) a=0
a=0 while True: z=str(input()) if z == '0' : break for i in z: k=int(i) a+=k print(a) a=0
[["+", 8, 196, 0, 57, 15, 666, 0, 557, 0, 654], ["+", 8, 196, 0, 57, 15, 666, 0, 557, 0, 655]]
5
41
# Belongs to : midandfeed aka asilentvoice while(1): n = str(input()) if n: ans = 0 for x in n: ans += int(x) print(ans) else: break
# Belongs to : midandfeed aka asilentvoice while(1): n = str(input()) if n != '0': ans = 0 for x in n: ans += int(x) print(ans) else: break
[["+", 0, 52, 8, 196, 0, 57, 15, 666, 667, 79], ["+", 8, 196, 0, 57, 15, 666, 0, 557, 0, 654], ["+", 8, 196, 0, 57, 15, 666, 0, 557, 0, 6], ["+", 8, 196, 0, 57, 15, 666, 0, 557, 0, 655]]
5
38
package main import ( "fmt" "strings" ) func main(){ var s, p string fmt.Scan(&s, &p) s = s+s[:len(p)] fmt.Println(s) ans := strings.Index(s, p) if ans==-1{ fmt.Println("No") }else{ fmt.Println("Yes") } }
package main import ( "fmt" "strings" ) func main(){ var s, p string fmt.Scan(&s, &p) s = s+s[:len(p)] ans := strings.Index(s, p) if ans==-1{ fmt.Println("No") }else{ fmt.Println("Yes") } }
[["-", 8, 196, 0, 1, 0, 2, 63, 438, 439, 22], ["-", 8, 196, 0, 1, 0, 2, 63, 438, 0, 131], ["-", 8, 196, 0, 1, 0, 2, 63, 438, 119, 120], ["-", 8, 196, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 36, 36, 0, 434, 0, 435, 8, 196, 0, 165]]
7
99
package main import ( "bufio" "fmt" "os" "strings" ) func main() { scanner := bufio.NewScanner(os.Stdin) scanner.Scan() s := scanner.Text() scanner.Scan() p := scanner.Text() sum_s := s for i, rune_s := range s { if i != len(s) { sum_s += string(rune_s) } } if strings.Contains(sum_s, p) { f...
package main import ( "bufio" "fmt" "os" "strings" ) func main() { scanner := bufio.NewScanner(os.Stdin) scanner.Scan() s := scanner.Text() scanner.Scan() p := scanner.Text() sum_s := s for i, rune_s := range s { if i != len(s) { sum_s += string(rune_s) } } if strings.Contains(sum_s, p) { f...
[]
7
133
"use strict"; main(require("fs") .readFileSync("/dev/stdin", "utf8") .replace(/\r?\n$/, "") .split(/\r?\n/)); function main(lines) { var w = lines.shift(); var t = lines.join("").replace(/END_OF_TEXT\s*$/, ""); console.log(t.split(new RegExp("\\b" + w + "\\b", "i")).length - 1) }
"use strict"; main(require("fs") .readFileSync("/dev/stdin", "utf8") .replace(/\r?\n$/, "") .split(/\r?\n/)); function main(lines) { var w = lines.shift(); var t = lines.join().replace(/END_OF_TEXT\s*$/, ""); console.log(t.split(new RegExp("\\b" + w + "\\b", "i")).length - 1) }
[["-", 63, 558, 500, 2, 3, 3, 0, 557, 0, 62]]
2
112
<?php $W = fgets(STDIN); $W = trim($W); $count = 0; while (false !== ($line = fgets(STDIN))) { $line = trim($line); if ('END_OF_TEXT' === $line) { break; } $words = preg_split('/\s+/', $line, -1, PREG_SPLIT_NO_EMPTY); $count += array_reduce($words, function ($carry, $item) use ($W) { retur...
<?php $W = fgets(STDIN); $W = trim($W); $count = 0; while (false !== ($line = fgets(STDIN))) { $line = trim($line); if ('END_OF_TEXT' === $line) { break; } $words = preg_split('/\s+/', $line, -1, PREG_SPLIT_NO_EMPTY); $count += array_reduce($words, function ($carry, $item) use ($W) { retur...
[["+", 0, 41, 15, 23, 0, 16, 31, 613, 63, 141], ["+", 15, 23, 0, 16, 31, 613, 3, 3, 0, 24], ["+", 15, 23, 0, 16, 31, 613, 3, 3, 0, 25], ["+", 0, 41, 15, 23, 0, 16, 12, 613, 63, 141], ["+", 15, 23, 0, 16, 12, 613, 3, 3, 0, 24], ["+", 15, 23, 0, 16, 12, 613, 3, 3, 0, 25]]
6
130
<?php $array_data=array(); $end_word="END_OF_TEXT"; while(1){ $x=trim(fgets(STDIN)); // end_word?????¨????????? if($x==$end_word){ break; } $array_data[]=$x; } // print_r($array_data); $W=$array_data[0]; $cnt=0; for($i=1;$i<count($array_data);$i++){ WordCheck($array_data[$i],$W,$cnt); } printf("%d"...
<?php $array_data=array(); $end_word="END_OF_TEXT"; while(1){ $x=trim(fgets(STDIN)); // end_word?????¨????????? if($x==$end_word){ break; } $array_data[]=$x; } // print_r($array_data); $W=$array_data[0]; $cnt=0; for($i=1;$i<count($array_data);$i++){ WordCheck($array_data[$i],$W,$cnt); } printf("%d\...
[["+", 0, 613, 3, 3, 0, 28, 0, 609, 0, 44], ["+", 0, 614, 8, 9, 0, 57, 15, 23, 0, 24], ["+", 0, 57, 15, 23, 0, 16, 31, 613, 63, 141], ["+", 15, 23, 0, 16, 31, 613, 3, 3, 0, 25]]
6
164
<?php $keyword = trim(fgets(STDIN)); $count = 0; while($sentence = trim(fgets(STDIN))) { if($sentence == "END_OF_TEXT") { echo $count."\n"; exit; } $target = explode(" ",$sentence); foreach($target as $value){ if($val...
<?php $keyword = trim(fgets(STDIN)); $count = 0; while($sentence = trim(fgets(STDIN))) { if($sentence == "END_OF_TEXT") { echo $count."\n"; exit; } $target = explode(" ",$sentence); foreach($target as $value){ if(strt...
[["+", 0, 57, 15, 23, 0, 16, 31, 613, 63, 141], ["+", 15, 23, 0, 16, 31, 613, 3, 3, 0, 24], ["+", 15, 23, 0, 16, 31, 613, 3, 3, 0, 25], ["+", 0, 57, 15, 23, 0, 16, 12, 613, 63, 141], ["+", 15, 23, 0, 16, 12, 613, 3, 3, 0, 24], ["+", 15, 23, 0, 16, 12, 613, 3, 3, 0, 25]]
6
88
<?php $w = strtolower(trim(fgets(STDIN))); $t=''; $cnt = 0; $array=array(); while ($line = fgets(STDIN)) { $t .= strtolower(trim($line)); } $array = explode('\n', $t); foreach($array as $hoge){ if ($hoge === $w) { $cnt++; } } echo $cnt.PHP_EOL; ?>
<?php $w = strtolower(trim(fgets(STDIN))); $t=''; $cnt = 0; $array=array(); while ($line = fgets(STDIN)) { $t .= strtolower(trim($line)." "); } $array = explode(" ", $t); foreach($array as $hoge){ if ($hoge === $w) { $cnt++; } } echo $cnt.PHP_EOL; ?>
[["+", 12, 613, 3, 3, 0, 28, 0, 16, 17, 131], ["+", 3, 3, 0, 28, 0, 16, 12, 609, 0, 62], ["+", 3, 3, 0, 28, 0, 16, 12, 609, 0, 610], ["-", 12, 613, 3, 3, 0, 28, 0, 557, 0, 104], ["-", 12, 613, 3, 3, 0, 28, 0, 557, 0, 610], ["+", 12, 613, 3, 3, 0, 28, 0, 609, 0, 62], ["+", 12, 613, 3, 3, 0, 28, 0, 609, 0, 610]]
6
101
import java.util.*; import java.util.regex.Pattern; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); String w = sc.next(); int cnt = 0; char c; String str; String[] str2; int i; while (true) { str = sc.next(); ...
import java.util.*; import java.util.regex.Pattern; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); String w = sc.next(); int cnt = 0; char c; String str; String[] str2; int i; while (true) { str = sc.next(); ...
[["+", 0, 52, 8, 196, 0, 7, 8, 196, 0, 45], ["+", 0, 195, 8, 196, 0, 52, 8, 196, 0, 46], ["+", 0, 1, 0, 11, 12, 492, 500, 492, 0, 131], ["+", 0, 1, 0, 11, 12, 492, 500, 492, 141, 22], ["+", 0, 11, 12, 492, 500, 492, 3, 4, 0, 24], ["+", 0, 11, 12, 492, 500, 492, 3, 4, 0, 25]]
3
261
import java.util.NoSuchElementException; import java.util.Scanner; public class Main { private static int W = 10; private static int T = 1000; public static void main(String[] args) { Scanner sc = new Scanner(System.in); try { String w = sc.nextLine(); if (w.length() != W) { System.ou...
import java.util.NoSuchElementException; import java.util.Scanner; public class Main { private static int W = 10; private static int T = 1000; public static void main(String[] args) { Scanner sc = new Scanner(System.in); try { String w = sc.nextLine(); if (w.length() > W) { System.out...
[["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 79], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 47], ["+", 8, 196, 0, 57, 64, 196, 0, 1, 0, 35], ["+", 8, 196, 0, 57, 64, 196, 0, 37, 0, 38], ["-", 8, 196, 0, 57, 15, 15, 0, 492, 141, 22], ["+", 8, 196, 0, 57, 15, 15, 0, 492, 141, 22]]
3
173
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s, text[]; text = new String[10000000]; int count = 0; s = sc.next(); int i = 0; while (true) { text[i] = sc.next(); if (text[i].equals("END_OF...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s, text[]; text = new String[10000000]; int count = 0; s = sc.next(); int i = 0; while (true) { text[i] = sc.next(); if (text[i].equals("END_OF...
[["-", 8, 196, 0, 57, 15, 15, 0, 492, 141, 22], ["+", 8, 196, 0, 57, 15, 15, 0, 492, 141, 22]]
3
146
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String word = sc.next(); int count = 0; while (true) { String text = sc.next(); if (text.equals("END_OF_TEXT")) break; if (word.equals(text)) { ...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String word = sc.next(); int count = 0; while (true) { String text = sc.next(); if (text.equals("END_OF_TEXT")) break; if (word.compareToIgnoreCase...
[["-", 8, 196, 0, 57, 15, 15, 0, 492, 141, 22], ["+", 0, 57, 15, 15, 0, 16, 31, 492, 141, 22], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 60], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 12, 499]]
3
105
import java.util.ArrayList; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); ArrayList<String> array = new ArrayList<String>(); String w = sc.next(); while (sc.hasNext()) { array.add(sc.next()); } sc.close(); ...
import java.util.ArrayList; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); ArrayList<String> array = new ArrayList<String>(); String w = sc.next(); while (sc.hasNext()) { array.add(sc.next()); } sc.close(); ...
[["-", 8, 196, 0, 57, 15, 15, 0, 492, 141, 22], ["+", 8, 196, 0, 57, 15, 15, 0, 492, 141, 22]]
3
129
import java.util.Arrays; import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); final String word = sc.next(); int count = 0; while (true) { final String txt = sc.next(); ...
import java.util.Arrays; import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); final String word = sc.next(); int count = 0; while (true) { final String txt = sc.next(); ...
[["-", 0, 57, 75, 57, 15, 15, 0, 492, 141, 22], ["+", 0, 57, 75, 57, 15, 15, 0, 492, 141, 22]]
3
126
import java.io.*; import java.util.*; class Main { public static void main(String args[]) { try { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String w = br.readLine(); String l; List<String> t = new ArrayList<String>(); while (!(l = br.readLine()).equal...
import java.io.*; import java.util.*; class Main { public static void main(String args[]) { try { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String w = br.readLine(); String l; List<String> t = new ArrayList<String>(); while (!(l = br.readLine()).equal...
[["-", 8, 196, 0, 57, 15, 15, 0, 492, 141, 22], ["+", 8, 196, 0, 57, 15, 15, 0, 492, 141, 22]]
3
169
import java.awt.Frame; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.math.BigInteger; import java.time.chrono.MinguoChronology; import java.util.Arrays; import java.util.Scanne...
import java.awt.Frame; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.math.BigInteger; import java.time.chrono.MinguoChronology; import java.util.Arrays; import java.util.Scanne...
[["+", 0, 57, 15, 15, 0, 492, 500, 492, 141, 22], ["+", 15, 15, 0, 492, 500, 492, 3, 4, 0, 24], ["+", 15, 15, 0, 492, 500, 492, 3, 4, 0, 25], ["+", 8, 196, 0, 57, 15, 15, 0, 492, 0, 131]]
3
489
s = print() p = print() s *= 2 if s.find(p) != -1: print("Yes") else: print("No")
s = input() p = input() s *= 2 if s.find(p) != -1: print("Yes") else: print("No")
[["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22]]
5
38
def check(s, p): count = 0 for i in range(len(s)): for j in range(len(p)): if s[(i+j) % len(s)] != p[j]: break count += 1 if count == len(p): return True return False s = input() p = input() flag = check(s, p) if flag: print("Yes") els...
def check(s, p): for i in range(len(s)): count = 0 for j in range(len(p)): if s[(i+j) % len(s)] != p[j]: break count += 1 if count == len(p): return True return False s = input() p = input() flag = check(s, p) if flag: print("Yes")...
[["-", 0, 14, 8, 196, 0, 1, 0, 662, 31, 22], ["-", 0, 14, 8, 196, 0, 1, 0, 662, 0, 32], ["-", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 12, 612]]
5
104