Update all new Tasks

This commit is contained in:
Ingy döt Net 2015-02-20 09:02:09 -05:00
parent 00a190b0a6
commit 91df62d461
5697 changed files with 93386 additions and 804 deletions

View file

@ -0,0 +1,35 @@
is_repeated() {
local str=$1 len rep part
for (( len = ${#str} / 2; len > 0; len-- )); do
part=${str:0:len}
rep=""
while (( ${#rep} < ${#str} )); do
rep+=$part
done
if [[ ${rep:0:${#str}} == $str ]] && (( $len < ${#str} )); then
echo "$part"
return 0
fi
done
return 1
}
while read test; do
if part=$( is_repeated "$test" ); then
echo "$test is composed of $part repeated"
else
echo "$test is not a repeated string"
fi
done <<END_TESTS
1001110011
1110111011
0010010010
1010101010
1111111111
0100101101
0100100
101
11
00
1
END_TESTS